Skip to content

Commit 1f05728

Browse files
authored
gh-142418: Restore __partialmethod__ handling in _has_coroutine_mark
1 parent 9961179 commit 1f05728

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Lib/inspect.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,20 @@ def _has_coroutine_mark(f):
316316
f = f.__func__
317317
continue
318318

319+
# Functions created by partialmethod descriptors keep a __partialmethod__ reference
320+
pm = getattr(f, "__partialmethod__", None)
321+
if isinstance(pm, functools.partialmethod):
322+
f = pm
323+
continue
324+
319325
# partial and partialmethod share .func
320326
if isinstance(f, (functools.partial, functools.partialmethod)):
321327
f = f.func
322328
continue
323329

324330
return False
325331

332+
326333
def markcoroutinefunction(func):
327334
"""
328335
Decorator to ensure callable is recognised as a coroutine function.

0 commit comments

Comments
 (0)