Skip to content
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

Fix type checks for functions passed to async_to_sync/sync_to_async #252

Merged
merged 1 commit into from
Apr 6, 2021

Conversation

KristobalJunta
Copy link
Contributor

@KristobalJunta KristobalJunta commented Apr 6, 2021

On Python < 3.8 a functool.partial is not detected as async function, which is due to a bug in inspect module, see: https://bugs.python.org/issue33261

This commit adds a proper type check for earlier Python versions and fixes #251

Idea taken from pgjones' comment.

@KristobalJunta KristobalJunta force-pushed the main branch 2 times, most recently from c2a893b to 2a7943f Compare April 6, 2021 15:09
On Python < 3.8 a functool.partial is not detected as async function,
which is due to a bug in inspect module, see https://bugs.python.org/issue33261

This commit adds a proper type check for earlier Python versions and fixes django#251.
@andrewgodwin
Copy link
Member

Lovely, thanks so much for getting this done.

adamchainz referenced this pull request Apr 7, 2021
Detecting if a function is async in Python has a lot of false
negatives, so this is a lot safer while async code we call all makes
sure it has the coroutinefunction flag set.
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 this pull request may close these issues.

Static Files Error With The Latest Version (3.3.2)
2 participants