From patchwork Mon Dec 16 06:32:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7674: typing: add a couple of assertions to lrucachedict to help pytype From: phabricator X-Patchwork-Id: 43860 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Mon, 16 Dec 2019 06:32:34 +0000 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 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.