mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	Use __pyx_vtable__ instead of __reduce_cython__
This commit is contained in:
		
							parent
							
								
									43c92ec8c9
								
							
						
					
					
						commit
						da30bae8a6
					
				| 
						 | 
					@ -1301,12 +1301,14 @@ def minibatch(items, size):
 | 
				
			||||||
def is_cython_func(func: Callable) -> bool:
 | 
					def is_cython_func(func: Callable) -> bool:
 | 
				
			||||||
    """Slightly hacky check for whether a callable is implemented in Cython.
 | 
					    """Slightly hacky check for whether a callable is implemented in Cython.
 | 
				
			||||||
    Can be used to implement slightly different behaviors, especially around
 | 
					    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.
 | 
					    func (Callable): The callable to check.
 | 
				
			||||||
    RETURNS (bool): Whether the callable is Cython (probably).
 | 
					    RETURNS (bool): Whether the callable is Cython (probably).
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    attr = "__reduce_cython__"
 | 
					    attr = "__pyx_vtable__"
 | 
				
			||||||
    if hasattr(func, attr):  # function or class instance
 | 
					    if hasattr(func, attr):  # function or class instance
 | 
				
			||||||
        return True
 | 
					        return True
 | 
				
			||||||
    # https://stackoverflow.com/a/55767059
 | 
					    # https://stackoverflow.com/a/55767059
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user