Patchwork D7409: dispatch: add some assertions to give pytype a helping hand

login
register
mail settings
Submitter phabricator
Date Nov. 19, 2019, 3:51 a.m.
Message ID <b53ff8c1c4271444b1edbc10d534366a@localhost.localdomain>
Download mbox | patch
Permalink /patch/43347/
State Not Applicable
Headers show

Comments

phabricator - Nov. 19, 2019, 3:51 a.m.
Closed by commit rHGac8fd215a776: dispatch: add some assertions to give pytype a helping hand (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7409?vs=18102&id=18229

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

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

AFFECTED FILES
  mercurial/dispatch.py

CHANGE DETAILS




To: durin42, #hg-reviewers, dlax, indygreg
Cc: mercurial-devel

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -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: