[prev in list] [next in list] [prev in thread] [next in thread]
List: mercurial-devel
Subject: D11718: typing: add a few assertions to revlog.py to help pytype
From: "mharbison72 (Matt Harbison)" <phabricator () mercurial-scm ! org>
Date: 2021-10-23 20:06:52
Message-ID: differential-rev-PHID-DREV-rrmsv2zqatfvagmwtkic-req () mercurial-scm ! org
[Download RAW message or body]
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
I've seen this before, but this was seen as potentially `None` with pytype
2021.10.18.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D11718
AFFECTED FILES
mercurial/revlog.py
CHANGE DETAILS
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2581,10 +2581,15 @@
self._enforceinlinesize(transaction)
if self._docket is not None:
# revlog-v2 always has 3 writing handles, help Pytype
- assert self._writinghandles[2] is not None
- self._docket.index_end = self._writinghandles[0].tell()
- self._docket.data_end = self._writinghandles[1].tell()
- self._docket.sidedata_end = self._writinghandles[2].tell()
+ wh1 = self._writinghandles[0]
+ wh2 = self._writinghandles[1]
+ wh3 = self._writinghandles[2]
+ assert wh1 is not None
+ assert wh2 is not None
+ assert wh3 is not None
+ self._docket.index_end = wh1.tell()
+ self._docket.data_end = wh2.tell()
+ self._docket.sidedata_end = wh3.tell()
nodemaputil.setup_persistent_nodemap(transaction, self)
To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic