File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -399,8 +399,6 @@ def _has_coroutine_mark(f):
399
399
while ismethod (f ):
400
400
f = f .__func__
401
401
f = functools ._unwrap_partial (f )
402
- if not (isfunction (f ) or _signature_is_functionlike (f )):
403
- return False
404
402
return getattr (f , "_is_coroutine_marker" , None ) is _is_coroutine_marker
405
403
406
404
def markcoroutinefunction (func ):
Original file line number Diff line number Diff line change @@ -223,6 +223,10 @@ async def __call__(self):
223
223
self .assertFalse (inspect .iscoroutinefunction (Cl ))
224
224
# instances with async def __call__ are NOT recognised.
225
225
self .assertFalse (inspect .iscoroutinefunction (Cl ()))
226
+ # unless explicitly marked.
227
+ self .assertTrue (inspect .iscoroutinefunction (
228
+ inspect .markcoroutinefunction (Cl ())
229
+ ))
226
230
227
231
class Cl2 :
228
232
@inspect .markcoroutinefunction
@@ -232,6 +236,10 @@ def __call__(self):
232
236
self .assertFalse (inspect .iscoroutinefunction (Cl2 ))
233
237
# instances with marked __call__ are NOT recognised.
234
238
self .assertFalse (inspect .iscoroutinefunction (Cl2 ()))
239
+ # unless explicitly marked.
240
+ self .assertTrue (inspect .iscoroutinefunction (
241
+ inspect .markcoroutinefunction (Cl2 ())
242
+ ))
235
243
236
244
class Cl3 :
237
245
@inspect .markcoroutinefunction
You can’t perform that action at this time.
0 commit comments