diff --git a/spacy/util.py b/spacy/util.py index f55b03db8..013c87acc 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -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)