Skip to content

Commit 367d2a6

Browse files
authored
Merge branch 'master' into feature/deprecate-propagate_traces
2 parents 2926c00 + 9ff100a commit 367d2a6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sentry_sdk/utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def get_lines_from_file(
571571

572572
def get_source_context(
573573
frame, # type: FrameType
574-
tb_lineno, # type: int
574+
tb_lineno, # type: Optional[int]
575575
max_value_length=None, # type: Optional[int]
576576
):
577577
# type: (...) -> Tuple[List[Annotated[str]], Optional[Annotated[str]], List[Annotated[str]]]
@@ -587,11 +587,13 @@ def get_source_context(
587587
loader = frame.f_globals["__loader__"]
588588
except Exception:
589589
loader = None
590-
lineno = tb_lineno - 1
591-
if lineno is not None and abs_path:
590+
591+
if tb_lineno is not None and abs_path:
592+
lineno = tb_lineno - 1
592593
return get_lines_from_file(
593594
abs_path, lineno, max_value_length, loader=loader, module=module
594595
)
596+
595597
return [], None, []
596598

597599

0 commit comments

Comments
 (0)