Skip to content

ref: Allow to start and finish StreamedSpans (9)#5598

Merged
sentrivana merged 58 commits into
masterfrom
ivana/span-first-9-start-end
Mar 10, 2026
Merged

ref: Allow to start and finish StreamedSpans (9)#5598
sentrivana merged 58 commits into
masterfrom
ivana/span-first-9-start-end

add a guard

dab1970
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
GitHub Actions / warden completed Mar 9, 2026 in 2m 46s

2 issues

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").

hasattr() called with wrong arguments causes TypeError - `sentry_sdk/traces.py:454-455`

Line 454 calls hasattr(self._previous_span_on_scope) with only one argument. The hasattr() builtin requires exactly two arguments: hasattr(object, name). This code will raise TypeError: hasattr expected 2 arguments, got 1 every time _end() is called on a NoOpStreamedSpan with a non-None scope. The intended check was likely hasattr(self, "_previous_span_on_scope") to verify the attribute was set during _start().

4 skills analyzed
Skill Findings Duration Cost
code-review 1 2m 37s $0.79
find-bugs 1 2m 38s $0.94
skill-scanner 0 1m 57s $0.27
security-review 0 1m 45s $0.51

Duration: 8m 56s · Tokens: 1.7M in / 21.3k out · Cost: $2.54 (+fix_gate: $0.01, +dedup: $0.01)