# HG changeset patch # User Augie Fackler # Date 2017-03-03 18:27:21 # Node ID d79761fe697fafd6bc5a2b7e15a37169c66d4ade # Parent 1871a1ee64ed49172b1568b89cdbab126284b309 extensions: use inspect module instead of func_code.co_argcount Fixes the extsetup argspec check on Python 3. diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -8,6 +8,7 @@ from __future__ import absolute_import import imp +import inspect import os from .i18n import ( @@ -150,7 +151,7 @@ def _runextsetup(name, ui): try: extsetup(ui) except TypeError: - if extsetup.func_code.co_argcount != 0: + if inspect.getargspec(extsetup).args: raise extsetup() # old extsetup with no ui argument