-
Notifications
You must be signed in to change notification settings - Fork 572
fix(threading): Handle channels shadowing #5299
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,11 +54,14 @@ def setup_once() -> None: | |
|
|
||
| try: | ||
| from django import VERSION as django_version # noqa: N811 | ||
| except ImportError: | ||
| django_version = None | ||
|
|
||
| try: | ||
| import channels # type: ignore[import-untyped] | ||
|
|
||
| channels_version = channels.__version__ | ||
| except ImportError: | ||
| django_version = None | ||
| except (ImportError, AttributeError): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this implies that if there is an AttributeError because of channels line,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's ok, But you raise a good point in that it's not clear what the variable is used for. It might happen that someone extends the logic at some point using
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| channels_version = None | ||
|
|
||
| is_async_emulated_with_threads = ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this implies that if there is an AttributeError because of channels line,
django_versionwill be set toNoneand that is not ideal... perhaps we should split this try/except in 2 parts, 1 fordjangoand another forchannels?