changeset 48283:ebac18733142

typing: add a few assertions to revlog.py to help pytype I've seen this before, but this was seen as potentially `None` with pytype 2021.10.18. Differential Revision: https://phab.mercurial-scm.org/D11718
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 23 Oct 2021 16:04:05 -0400
parents 0d6a099bba58
children 9de0823705b4
files mercurial/revlog.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Oct 21 09:22:06 2021 +0200
+++ b/mercurial/revlog.py	Sat Oct 23 16:04:05 2021 -0400
@@ -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)