diff mercurial/extensions.py @ 36178:646002338365

py3: introduce and use pycompat.getargspec This is getfullargspec on py3, which means we can't use namedtuple named accessors for all fields (eg keywords from getargspec is varkw from getfullargspec, with the same meaning). Solves some warning issues on Python 3. I didn't clean up httpclient because that's vendored code I think we should probably discard, and I didn't touch the manpage generator for now either. Differential Revision: https://phab.mercurial-scm.org/D2251
author Augie Fackler <augie@google.com>
date Tue, 13 Feb 2018 23:00:01 -0700
parents 78d9a7b7cdb6
children 4088e568a411
line wrap: on
line diff
--- a/mercurial/extensions.py	Tue Feb 13 23:37:58 2018 -0500
+++ b/mercurial/extensions.py	Tue Feb 13 23:00:01 2018 -0700
@@ -195,11 +195,7 @@
             try:
                 extsetup(ui)
             except TypeError:
-                # Try to use getfullargspec (Python 3) first, and fall
-                # back to getargspec only if it doesn't exist so as to
-                # avoid warnings.
-                if getattr(inspect, 'getfullargspec',
-                           getattr(inspect, 'getargspec'))(extsetup).args:
+                if pycompat.getargspec(extsetup).args:
                     raise
                 extsetup() # old extsetup with no ui argument
         except Exception as inst: