Patchwork D7445: doc: don't use mutable default arguments

login
register
mail settings
Submitter phabricator
Date Nov. 16, 2019, 8:08 p.m.
Message ID <differential-rev-PHID-DREV-sxrk3u4v6dzomew6fhpx-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43313/
State Superseded
Headers show

Comments

phabricator - Nov. 16, 2019, 8:08 p.m.
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




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

Patch

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()