!6734 fix bug of getting python function name
Merge pull request !6734 from fary86/fix_bug_of_get_py_function_name
This commit is contained in:
commit
ea9d39e84b
|
@ -339,7 +339,9 @@ def get_object_description(obj, fname, fline):
|
|||
_, cls_fline = inspect.getsourcelines(obj_cls)
|
||||
class_loc = f'{cls_fname}:{cls_fline}'
|
||||
return f"bound method '{obj.__name__}' at {fname}:{fline} of <{class_name} at {class_loc} object>"
|
||||
if isinstance(obj, (types.FunctionType, ast.FunctionDef)):
|
||||
if isinstance(obj, types.FunctionType):
|
||||
return f"function '{obj.__name__}' at {fname}:{fline}"
|
||||
if isinstance(obj, ast.FunctionDef):
|
||||
return f"function '{obj.name}' at {fname}:{fline}"
|
||||
return str(obj)
|
||||
|
||||
|
|
Loading…
Reference in New Issue