Mercurial > hg
comparison mercurial/extensions.py @ 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 | 50c44dee741a |
children | 38a3767975a7 |
comparison
equal
deleted
inserted
replaced
33721:24849d53697d | 33722:62fbe95075d3 |
---|---|
184 if extsetup: | 184 if extsetup: |
185 try: | 185 try: |
186 try: | 186 try: |
187 extsetup(ui) | 187 extsetup(ui) |
188 except TypeError: | 188 except TypeError: |
189 if inspect.getargspec(extsetup).args: | 189 # Try to use getfullargspec (Python 3) first, and fall |
190 # back to getargspec only if it doesn't exist so as to | |
191 # avoid warnings. | |
192 if getattr(inspect, 'getfullargspec', | |
193 getattr(inspect, 'getargspec'))(extsetup).args: | |
190 raise | 194 raise |
191 extsetup() # old extsetup with no ui argument | 195 extsetup() # old extsetup with no ui argument |
192 except Exception as inst: | 196 except Exception as inst: |
193 ui.traceback() | 197 ui.traceback() |
194 msg = util.forcebytestr(inst) | 198 msg = util.forcebytestr(inst) |