Skip to content

Commit

Permalink
Guard against sentry initialization mid sqlalchemy cursor (#2702)
Browse files Browse the repository at this point in the history
  • Loading branch information
apmorton committed Feb 5, 2024
1 parent ad86d61 commit 4afb955
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _after_cursor_execute(conn, cursor, statement, parameters, context, *args):
context._sentry_sql_span_manager = None
ctx_mgr.__exit__(None, None, None)

span = context._sentry_sql_span
span = getattr(context, "_sentry_sql_span", None) # type: Optional[Span]
if span is not None:
with capture_internal_exceptions():
add_query_source(hub, span)
Expand Down

0 comments on commit 4afb955

Please sign in to comment.