ref: Allow to start and finish StreamedSpans (9)#5598
Merged
GitHub Actions / warden: code-review
completed
Mar 9, 2026 in 2m 38s
1 issue
code-review: Found 1 issue (1 high)
High
hasattr() call is missing required second argument, causing TypeError at runtime - `sentry_sdk/traces.py:454-455`
The hasattr(self._previous_span_on_scope) call on line 454 is missing the required second argument. Python's hasattr() requires two arguments: the object and the attribute name as a string. This will raise TypeError: hasattr expected 2 arguments, got 1 whenever _end() is called on a NoOpStreamedSpan with a valid _scope. The fix should be hasattr(self, "_previous_span_on_scope").
Duration: 2m 37s · Tokens: 584.9k in / 7.5k out · Cost: $0.79 (+fix_gate: $0.00)
Annotations
Check failure on line 455 in sentry_sdk/traces.py
github-actions / warden: code-review
hasattr() call is missing required second argument, causing TypeError at runtime
The `hasattr(self._previous_span_on_scope)` call on line 454 is missing the required second argument. Python's `hasattr()` requires two arguments: the object and the attribute name as a string. This will raise `TypeError: hasattr expected 2 arguments, got 1` whenever `_end()` is called on a `NoOpStreamedSpan` with a valid `_scope`. The fix should be `hasattr(self, "_previous_span_on_scope")`.
Loading