mercurial/util.py
changeset 44456 09f3e003fc2a
parent 44060 a61287a95dc3
child 44470 9d2b2df2c2ba
--- a/mercurial/util.py	Fri Jan 24 15:51:19 2020 -0800
+++ b/mercurial/util.py	Wed Mar 04 00:45:54 2020 -0500
@@ -1846,14 +1846,14 @@
     return pycompat.ossep.join(([b'..'] * len(a)) + b) or b'.'
 
 
-def checksignature(func):
+def checksignature(func, depth=1):
     '''wrap a function with code to check for calling errors'''
 
     def check(*args, **kwargs):
         try:
             return func(*args, **kwargs)
         except TypeError:
-            if len(traceback.extract_tb(sys.exc_info()[2])) == 1:
+            if len(traceback.extract_tb(sys.exc_info()[2])) == depth:
                 raise error.SignatureError
             raise