Several callable objects do not have __qualname__

This commit is contained in:
Koichi Yasuoka 2021-02-09 14:43:02 +09:00 committed by GitHub
parent ca3f8386d7
commit 8ed788660b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -930,6 +930,8 @@ def is_same_func(func1: Callable, func2: Callable) -> bool:
"""
if not callable(func1) or not callable(func2):
return False
if not hasattr(func1,"__qualname__") or not hasattr(func2,"__qualname__"):
return False
same_name = func1.__qualname__ == func2.__qualname__
same_file = inspect.getfile(func1) == inspect.getfile(func2)
same_code = inspect.getsourcelines(func1) == inspect.getsourcelines(func2)