@@ -298,6 +298,8 @@ def _has_code_flag(f, flag):
298298 f = functools ._unwrap_partial (f )
299299 if not (isfunction (f ) or _signature_is_functionlike (f )):
300300 return False
301+ # If it's a pure Python function, or an object that is duck type
302+ # of a Python function (Cython and Mock functions, for instance), then:
301303 return bool (f .__code__ .co_flags & flag )
302304
303305def isgeneratorfunction (obj ):
@@ -2338,7 +2340,7 @@ def _signature_from_function(cls, func, skip_bound_arg=True,
23382340 is_duck_function = True
23392341 else :
23402342 # If it's not a pure Python function, and not a duck type
2341- # of pure function:
2343+ # of pure function (Cython and Mock functions, for instance), then :
23422344 raise TypeError ('{!r} is not a Python function' .format (func ))
23432345
23442346 s = getattr (func , "__text_signature__" , None )
@@ -2531,7 +2533,7 @@ def _signature_from_callable(obj, *,
25312533
25322534 if isfunction (obj ) or _signature_is_functionlike (obj ):
25332535 # If it's a pure Python function, or an object that is duck type
2534- # of a Python function (Cython functions, for instance), then:
2536+ # of a Python function (Cython and Mock functions, for instance), then:
25352537 return _signature_from_function (sigcls , obj ,
25362538 skip_bound_arg = skip_bound_arg ,
25372539 globals = globals , locals = locals , eval_str = eval_str ,
0 commit comments