# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2020-01-21 21:47:06 # Node ID d3f776c4760e71205cc9beb31af362144354b59d # Parent beea86e4d332f333533d1d63b5de0fa5e8856d26 py3: catch AttributeError too with ImportError Looks like py3 raises AttributeError instead of ImportError. This is caught on windows. Differential Revision: https://phab.mercurial-scm.org/D7965 diff --git a/mercurial/color.py b/mercurial/color.py --- a/mercurial/color.py +++ b/mercurial/color.py @@ -44,7 +44,7 @@ try: b'cyan': (False, curses.COLOR_CYAN, b''), b'white': (False, curses.COLOR_WHITE, b''), } -except ImportError: +except (ImportError, AttributeError): curses = None _baseterminfoparams = {} diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -63,13 +63,13 @@ try: 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/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -685,7 +685,7 @@ def has_tic(): curses.COLOR_BLUE return matchoutput('test -x "`which tic`"', br'') - except ImportError: + except (ImportError, AttributeError): return False