D7965: py3: catch AttributeError too with ImportError
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Thu Feb 6 16:11:47 UTC 2020
Closed by commit rHG9a92b29cf930: py3: catch AttributeError too with ImportError (authored by pulkit).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D7965?vs=19499&id=19953
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D7965/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D7965
AFFECTED FILES
mercurial/color.py
mercurial/crecord.py
tests/hghave.py
CHANGE DETAILS
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -685,7 +685,7 @@
curses.COLOR_BLUE
return matchoutput('test -x "`which tic`"', br'')
- except ImportError:
+ except (ImportError, AttributeError):
return False
diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -63,13 +63,13 @@
import curses.ascii
curses.error
-except ImportError:
+except (ImportError, AttributeError):
# I have no idea if wcurses works with crecord...
try:
import wcurses as curses
curses.error
- except ImportError:
+ except (ImportError, AttributeError):
# wcurses is not shipped on Windows by default, or python is not
# compiled with curses
curses = False
diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -44,7 +44,7 @@
b'cyan': (False, curses.COLOR_CYAN, b''),
b'white': (False, curses.COLOR_WHITE, b''),
}
-except ImportError:
+except (ImportError, AttributeError):
curses = None
_baseterminfoparams = {}
To: pulkit, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
More information about the Mercurial-devel
mailing list