Patchwork D7673: util: rename a variable to avoid confusing pytype

login
register
mail settings
Submitter phabricator
Date Dec. 16, 2019, 4:13 a.m.
Message ID <differential-rev-PHID-DREV-vsh3eq5rrzvpbybdp322-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43846/
State Superseded
Headers show

Comments

phabricator - Dec. 16, 2019, 4:13 a.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Fixes the following warning:
  
    line 1205, in f: No attribute 'append' on Dict[nothing, nothing] [attribute-error]
          In Union[Dict[nothing, nothing], list]

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1195,12 +1195,12 @@ 
     '''cache the result of function calls'''
     # XXX doesn't handle keywords args
     if func.__code__.co_argcount == 0:
-        cache = []
+        listcache = []
 
         def f():
-            if len(cache) == 0:
-                cache.append(func())
-            return cache[0]
+            if len(listcache) == 0:
+                listcache.append(func())
+            return listcache[0]
 
         return f
     cache = {}