ref: Allow to start and finish StreamedSpans (9)#5598
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)