extensions: use inspect module instead of func_code.co_argcount
authorAugie Fackler <raf@durin42.com>
Fri, 03 Mar 2017 13:27:21 -0500
changeset 31263 d79761fe697f
parent 31262 1871a1ee64ed
child 31264 063d7957fa12
extensions: use inspect module instead of func_code.co_argcount Fixes the extsetup argspec check on Python 3.
mercurial/extensions.py
--- a/mercurial/extensions.py	Tue Mar 07 18:29:58 2017 -0800
+++ b/mercurial/extensions.py	Fri Mar 03 13:27:21 2017 -0500
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 import imp
+import inspect
 import os
 
 from .i18n import (
@@ -150,7 +151,7 @@
         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