changeset 43706:ac8fd215a776

dispatch: add some assertions to give pytype a helping hand Differential Revision: https://phab.mercurial-scm.org/D7409
author Augie Fackler <augie@google.com>
date Thu, 14 Nov 2019 15:49:21 -0500
parents 1ea33dff7841
children da5ccc591cff
files mercurial/dispatch.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Thu Nov 14 15:49:01 2019 -0500
+++ b/mercurial/dispatch.py	Thu Nov 14 15:49:21 2019 -0500
@@ -115,6 +115,8 @@
 
     # In all cases we try to flush stdio streams.
     if util.safehasattr(req.ui, b'fout'):
+        assert req.ui is not None  # help pytype
+        assert req.ui.fout is not None  # help pytype
         try:
             req.ui.fout.flush()
         except IOError as e:
@@ -122,6 +124,8 @@
             status = -1
 
     if util.safehasattr(req.ui, b'ferr'):
+        assert req.ui is not None  # help pytype
+        assert req.ui.ferr is not None  # help pytype
         try:
             if err is not None and err.errno != errno.EPIPE:
                 req.ui.ferr.write(
@@ -1108,6 +1112,7 @@
 
         repo = None
         cmdpats = args[:]
+        assert func is not None  # help out pytype
         if not func.norepo:
             # use the repo from the request only if we don't have -R
             if not rpath and not cwd: