# HG changeset patch # User Augie Fackler # Date 2017-07-26 02:48:46 # Node ID 62fbe95075d3439d101b1a4a89c4503560b13a31 # Parent 24849d53697d4e6724d9057f1ebc1045b8a5530d extensions: attempt to use non-deprecated inspect method Avoids some deprecation warnings when extension loading breaks. Differential Revision: https://phab.mercurial-scm.org/D295 diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -186,7 +186,11 @@ def _runextsetup(name, ui): try: extsetup(ui) except TypeError: - if inspect.getargspec(extsetup).args: + # 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: raise extsetup() # old extsetup with no ui argument except Exception as inst: