Skip to content

switch falsy check to is None

84a4c11
Select commit
Loading
Failed to load commit list.
Merged

fix(pydantic-ai): Use first-class hooks when available #5947

switch falsy check to is None
84a4c11
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: code-review completed Apr 10, 2026 in 5m 15s

1 issue

code-review: Found 1 issue (1 low)

Low

Span may leak if exception occurs after __enter__ in on_request hook - `sentry_sdk/integrations/pydantic_ai/__init__.py:52`

In the on_request hook, span.__enter__() is called on line 52, but if an exception occurs on the same line (e.g., dictionary assignment fails unexpectedly), the span won't be properly closed. While this is an edge case since the metadata check occurs earlier, wrapping the span entry in a try block would ensure proper cleanup.


Duration: 5m 14s · Tokens: 992.9k in / 13.4k out · Cost: $1.53