GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ref(transport): Remove redundant checks for dsn by psh9508 · Pull Request #6104 · getsentry/sentry-python

Conversation

@psh9508

@psh9508 psh9508 commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Description

Related Issue

  • Fixes ref(transport): Simplify redundant DSN check in Transport.__init__ #6089

What changed

Removed the redundant is not None check from the DSN conditional statement in Transport.init (transport.py).

Code Comparison:

# 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"]:).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sentry[bot] reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@psh9508
ref(transport): Remove redundant checks for dsn
7806481
@psh9508
psh9508 requested a review from a team as a code owner April 21, 2026 02:04
@github-actions

github-actions Bot commented Apr 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (ci) Cancel in-progress PR workflows on new commit push by joshuarli in #5994
  • (consts) Add updated span convention constants to SPANDATA by ericapisani in #6093
  • Add db.driver.name spans to database integrations by ericapisani in #6082

Bug Fixes 🐛

  • (google_genai) Redact binary data in inline_data and fix multi-part message extraction by ericapisani in #5977
  • (grpc) Add isolation_scope to async server interceptor by robinvd in #5940
  • (openai-agents) Resolve agent from bindings for openai-agents >= 0.14 by ericapisani in #6102
  • (profiler) Stop nulling buffer on teardown by ericapisani in #6075

Internal Changes 🔧

  • (celery) Remove unused NoOpMgr from utils by sentrivana in #6078
  • (ci) Update outdated pinned action version comments by JoshuaMoelans in #6088
  • (pydantic-ai) Remove dead Model.request patch by alexander-alderman-webb in #5956
  • (tests) Replace deprecated enable_tracingwith traces_sample_rate by sentrivana in #6077
  • (transport) Remove redundant checks for dsn by psh9508 in #6104
  • 🤖 Update test matrix with new releases (04/20) by github-actions in #6100
  • Set explicit base-branch for codecov action by ericapisani in #5992

🤖 This preview updates automatically when you update the PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sentrivana
sentrivana approved these changes Apr 21, 2026
View reviewed changes
@sentrivana
sentrivana enabled auto-merge (squash) April 21, 2026 10:29
psh9508 added 3 commits April 21, 2026 19:40
@psh9508
Merge branch 'master' into refactor/dns-check
3a073e1
@psh9508
Merge branch 'master' into refactor/dns-check
2c7c68a
@psh9508
Merge branch 'master' into refactor/dns-check
cd2891a
@psh9508

psh9508 commented Apr 22, 2026

Copy link
Copy Markdown
Contributor Author

@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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ericapisani
Merge branch 'master' into refactor/dns-check
377399b
@sentrivana
sentrivana merged commit 1b72b88 into getsentry:master Apr 24, 2026
151 of 152 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@psh9508
psh9508 deleted the refactor/dns-check branch April 25, 2026 00:51
This was referenced May 4, 2026
publish: getsentry/[email protected] getsentry/publish#8047
Closed
publish: getsentry/[email protected] getsentry/publish#8063
Closed
mgaligniana pushed a commit to mgaligniana/sentry-python that referenced this pull request Aug 9, 2026
@psh9508 @mgaligniana
ref(transport): Remove redundant checks for dsn (getsentry#6104)
6629104
### 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"]:`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sentrivana sentrivana sentrivana approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

ref(transport): Simplify redundant DSN check in Transport.__init__

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@psh9508 @sentrivana @ericapisani
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.