Mercurial > hg
changeset 33722:62fbe95075d3
extensions: attempt to use non-deprecated inspect method
Avoids some deprecation warnings when extension loading breaks.
Differential Revision: https://phab.mercurial-scm.org/D295
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 25 Jul 2017 22:48:46 -0400 |
parents | 24849d53697d |
children | 5b2f331d0a33 |
files | mercurial/extensions.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/extensions.py Thu Jun 15 14:22:25 2017 -0400 +++ b/mercurial/extensions.py Tue Jul 25 22:48:46 2017 -0400 @@ -186,7 +186,11 @@ 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: