From da30bae8a6f74bad87bcda5671a6a703b40315b2 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Tue, 29 Sep 2020 22:04:17 +0200 Subject: [PATCH] Use __pyx_vtable__ instead of __reduce_cython__ --- spacy/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spacy/util.py b/spacy/util.py index 2c33d737e..83a18b78a 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -1301,12 +1301,14 @@ def minibatch(items, size): def is_cython_func(func: Callable) -> bool: """Slightly hacky check for whether a callable is implemented in Cython. Can be used to implement slightly different behaviors, especially around - inspecting and parameter annotations. + inspecting and parameter annotations. Note that this will only return True + for actual cdef functions and methods, not regular Python functions defined + in Python modules. func (Callable): The callable to check. RETURNS (bool): Whether the callable is Cython (probably). """ - attr = "__reduce_cython__" + attr = "__pyx_vtable__" if hasattr(func, attr): # function or class instance return True # https://stackoverflow.com/a/55767059