Patchwork D6743: perf: handle NameError for `pycompat.foo` when pycompat wasn't imported

login
register
mail settings
Submitter phabricator
Date Aug. 20, 2019, 3:36 p.m.
Message ID <4891d26f0195128302b1e725ec13fbd4@localhost.localdomain>
Download mbox | patch
Permalink /patch/41359/
State Not Applicable
Headers show

Comments

phabricator - Aug. 20, 2019, 3:36 p.m.
Closed by commit rHGfd62b027d6a4: perf: handle NameError for `pycompat.foo` when pycompat wasn&#039;t imported (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6743?vs=16263&id=16272

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

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

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -132,7 +132,7 @@ 
         _maxint = sys.maxsize  # per py3 docs for replacing maxint
     else:
         _maxint = sys.maxint
-except (ImportError, AttributeError):
+except (NameError, ImportError, AttributeError):
     import inspect
     getargspec = inspect.getargspec
     _byteskwargs = identity
@@ -144,11 +144,11 @@ 
 try:
     # 4.7+
     queue = pycompat.queue.Queue
-except (AttributeError, ImportError):
+except (NameError, AttributeError, ImportError):
     # <4.7.
     try:
         queue = pycompat.queue
-    except (AttributeError, ImportError):
+    except (NameError, AttributeError, ImportError):
         queue = util.queue
 
 try: