Skip to content

Commit 617688e

Browse files
committed
Add extra check to Lib/asyncio/coroutines:coroutine for partial to preserve behaviour
1 parent adb5db6 commit 617688e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Lib/asyncio/coroutines.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,14 @@ def coroutine(func):
107107
If the coroutine is not yielded from before it is destroyed,
108108
an error message is logged.
109109
"""
110-
if inspect.iscoroutinefunction(func):
110+
if (inspect.iscoroutinefunction(func)
111+
and not isinstance(func, functools.partial)):
111112
# In Python 3.5 that's all we need to do for coroutines
112113
# defined with "async def".
113114
return func
114115

115-
if inspect.isgeneratorfunction(func):
116+
if (inspect.isgeneratorfunction(func)
117+
and not isinstance (func, functools.partial)):
116118
coro = func
117119
else:
118120
@functools.wraps(func)

0 commit comments

Comments
 (0)