Skip to content

Asynchronous classmethod handlers not recognized as coroutines if wrapped in functools.partial #1107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vladmunteanu opened this issue Dec 2, 2020 · 1 comment · Fixed by #1106

Comments

@vladmunteanu
Copy link
Contributor

if sys.version_info < (3, 8): # pragma: no cover

Although the recent 0.14.0 version adds support for functools.partial for Python 3.6 and Python 3.7, that support appears to be incomplete, not working for classmethods in Python 3.8.

I was unaware of the fact that inspect.iscoroutinefunction does not properly detect a functools.partial as async if it wraps an async classmethod.

TLDR: the previous PR was too cautious, we can always unwrap the functools.partial object to be sure we check the underlying object.

@JayH5
Copy link
Member

JayH5 commented Feb 2, 2021

I'm not certain it's relevant but linking to this suggested change in cPython: python/cpython#16600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants