[cleanup, jsinterp] Give functions names to help debugging

This commit is contained in:
pukkandan
2023-03-03 23:24:50 +05:30
parent 4815bbfc41
commit b2e0343ba0
2 changed files with 14 additions and 7 deletions

View File

@@ -6057,14 +6057,16 @@ class classproperty:
class function_with_repr:
def __init__(self, func):
def __init__(self, func, repr_=None):
functools.update_wrapper(self, func)
self.func = func
self.func, self.__repr = func, repr_
def __call__(self, *args, **kwargs):
return self.func(*args, **kwargs)
def __repr__(self):
if self.__repr:
return self.__repr
return f'{self.func.__module__}.{self.func.__qualname__}'