Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def setup_once() -> None:
import channels # type: ignore[import-untyped]

channels_version = channels.__version__
except ImportError:
except (ImportError, AttributeError):

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_version will be set to None and that is not ideal... perhaps we should split this try/except in 2 parts, 1 for django and another for channels?

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_version will be set to None and that is not ideal... perhaps we should split this try/except in 2 parts, 1 for django and another for channels?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's ok, django_version and channels_version both are only used for warning about a very specific Django/channels/sentry-sdk incompatibility that only appears in specific versions.

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 django_version for some other purpose, not realizing it's not always populated correctly. So it's worth making this nicer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

django_version = None
channels_version = None

Expand Down
Loading