File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed
Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -317,6 +317,7 @@ def markcoroutinefunction(func):
317317 """
318318 if hasattr (func , '__func__' ):
319319 func = func .__func__
320+ func = functools ._unwrap_partial (func )
320321 func ._is_coroutine_marker = _is_coroutine_mark
321322 return func
322323
Original file line number Diff line number Diff line change @@ -334,6 +334,17 @@ def do_something_static():
334334 self .assertTrue (inspect .iscoroutinefunction (Cl3 .do_something_classy ))
335335 self .assertTrue (inspect .iscoroutinefunction (Cl3 .do_something_static ))
336336
337+ # Test markcoroutinefunction with functools.partial
338+ async def _fn4 ():
339+ pass
340+
341+ def fn4 ():
342+ return _fn4 ()
343+
344+ partial_fn4 = functools .partial (fn4 )
345+ marked_partial_fn4 = inspect .markcoroutinefunction (partial_fn4 )
346+ self .assertTrue (inspect .iscoroutinefunction (marked_partial_fn4 ))
347+
337348 self .assertFalse (
338349 inspect .iscoroutinefunction (unittest .mock .Mock ()))
339350 self .assertTrue (
Original file line number Diff line number Diff line change 1+ Fix markcoroutinefunction by letting it set the coroutine function marker on
2+ underlying function correctly.
You can’t perform that action at this time.
0 commit comments