Patchwork D7674: typing: add a couple of assertions to lrucachedict to help pytype

login
register
mail settings
Submitter phabricator
Date Dec. 16, 2019, 6:32 a.m.
Message ID <d0058f73e900adb9196413ab3789375d@localhost.localdomain>
Download mbox | patch
Permalink /patch/43860/
State Not Applicable
Headers show

Comments

phabricator - Dec. 16, 2019, 6:32 a.m.
Closed by commit rHGb5655f337bd7: typing: add a couple of assertions to lrucachedict to help pytype (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7674?vs=18738&id=18750

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7674/new/

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

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1480,6 +1480,8 @@ 
             if default is _notset:
                 raise
             return default
+
+        assert node is not None  # help pytype
         value = node.value
         self.totalcost -= node.cost
         node.markempty()
@@ -1567,6 +1569,8 @@ 
         while n.key is _notset:
             n = n.prev
 
+        assert n is not None  # help pytype
+
         key, value = n.key, n.value
 
         # And remove it from the cache and mark it as empty.