D10210: crecord: null out the curses attribute with `None` on failure to import

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Sat Mar 13 19:34:23 UTC 2021


mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Pytype got really confused that this could be `Union[module, bool]`, and spewed
  about tons of attributes that are not available on `bool`.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/crecord.py

CHANGE DETAILS

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -64,7 +64,7 @@
 
     curses.error
 except (ImportError, AttributeError):
-    curses = False
+    curses = None
 
 
 class fallbackerror(error.Abort):



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list