File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 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):
399399 while ismethod (f ):
400400 f = f .__func__
401401 f = functools ._unwrap_partial (f )
402- if not (isfunction (f ) or _signature_is_functionlike (f )):
403- return False
404402 return getattr (f , "_is_coroutine_marker" , None ) is _is_coroutine_marker
405403
406404def markcoroutinefunction (func ):
Original file line number Diff line number Diff line change @@ -223,6 +223,10 @@ async def __call__(self):
223223 self .assertFalse (inspect .iscoroutinefunction (Cl ))
224224 # instances with async def __call__ are NOT recognised.
225225 self .assertFalse (inspect .iscoroutinefunction (Cl ()))
226+ # unless explicitly marked.
227+ self .assertTrue (inspect .iscoroutinefunction (
228+ inspect .markcoroutinefunction (Cl ())
229+ ))
226230
227231 class Cl2 :
228232 @inspect .markcoroutinefunction
@@ -232,6 +236,10 @@ def __call__(self):
232236 self .assertFalse (inspect .iscoroutinefunction (Cl2 ))
233237 # instances with marked __call__ are NOT recognised.
234238 self .assertFalse (inspect .iscoroutinefunction (Cl2 ()))
239+ # unless explicitly marked.
240+ self .assertTrue (inspect .iscoroutinefunction (
241+ inspect .markcoroutinefunction (Cl2 ())
242+ ))
235243
236244 class Cl3 :
237245 @inspect .markcoroutinefunction
You can’t perform that action at this time.
0 commit comments