Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions sentry_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def get_lines_from_file(

def get_source_context(
frame, # type: FrameType
tb_lineno, # type: int
tb_lineno, # type: Optional[int]
max_value_length=None, # type: Optional[int]
):
# type: (...) -> Tuple[List[Annotated[str]], Optional[Annotated[str]], List[Annotated[str]]]
Expand All @@ -587,11 +587,13 @@ def get_source_context(
loader = frame.f_globals["__loader__"]
except Exception:
loader = None
lineno = tb_lineno - 1
if lineno is not None and abs_path:

if tb_lineno is not None and abs_path:
lineno = tb_lineno - 1
return get_lines_from_file(
abs_path, lineno, max_value_length, loader=loader, module=module
)

return [], None, []


Expand Down
Loading