GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — ref(transport): Remove redundant checks for dsn by psh9508 · Pull Request #6104 · getsentry/sentry-python Conversation
Contributor
DescriptionRelated IssueWhat changedRemoved the redundant Code Comparison: # Before if options and options["dsn"] is not None and options["dsn"]: # After if options and options["dsn"]: WhyIn Python, the truthiness check ( Notes
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@sentrivana I've merged the latest master to keep the branch up to date, but the Warden workflow is failing with an authentication error ([@octokit/auth-app] appId option is required). It seems like a secret-access limitation for PRs from forks. Could you please take a look and help re-trigger or bypass the workflow? Thank you! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
### Description #### Related Issue * Fixes getsentry#6089 #### What changed Removed the redundant `is not None` check from the DSN conditional statement in `Transport.init` (`transport.py`). **Code Comparison:** ```python # Before if options and options["dsn"] is not None and options["dsn"]: # After if options and options["dsn"]: ``` #### Why In Python, the truthiness check (`options["dsn"]`) inherently evaluates `None` as falsy. Therefore, the explicit `is not None` guard is redundant. Removing it simplifies the logic while maintaining the same behavior. #### Notes * **Why not use `options.get('dsn')`?** While `.get()` is often used for safe dictionary access, a default value for `"dsn"` is already guaranteed in this context, so there is no risk of a `KeyError`. * **Consistency:** I intentionally kept the direct dictionary access (`options["dsn"]`) to remain consistent with the existing coding pattern used later in the same file (e.g., line 1165: `if options["dsn"]:`).
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
ref(transport): Simplify redundant DSN check in Transport.__init__
There was an error while loading. Please reload this page.