D7445: doc: don't use mutable default arguments

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Nov 16 20:08:41 UTC 2019


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It appears our mutable default arguments checker doesn't find
  arguments not on the first line of a function definition :(
  
  The arguments aren't used, so the default value is irrelevant.
  
  I found this when blackening this script in a future commit.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7445

AFFECTED FILES
  doc/runrst

CHANGE DETAILS

diff --git a/doc/runrst b/doc/runrst
--- a/doc/runrst
+++ b/doc/runrst
@@ -27,8 +27,7 @@
                      "http://docutils.sourceforge.net/\n")
     sys.exit(-1)
 
-def role_hg(name, rawtext, text, lineno, inliner,
-            options={}, content=[]):
+def role_hg(name, rawtext, text, lineno, inliner, options=None, content=None):
     text = "hg " + utils.unescape(text)
     linktext = nodes.literal(rawtext, text)
     parts = text.split()



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list