Skip to content

Commit d32e2ee

Browse files
fix: Fix abs_path bug in serialize_frame (#4599)
Fixes #4587 <!-- Describe your PR here --> --- Thank you for contributing to `sentry-python`! Please add tests to validate your changes, and lint your code using `tox -e linters`. Running the test suite on your PR might require maintainer approval.
1 parent b065719 commit d32e2ee

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sentry_sdk/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,14 @@ def serialize_frame(
591591
if tb_lineno is None:
592592
tb_lineno = frame.f_lineno
593593

594+
try:
595+
os_abs_path = os.path.abspath(abs_path) if abs_path else None
596+
except Exception:
597+
os_abs_path = None
598+
594599
rv = {
595600
"filename": filename_for_module(module, abs_path) or None,
596-
"abs_path": os.path.abspath(abs_path) if abs_path else None,
601+
"abs_path": os_abs_path,
597602
"function": function or "<unknown>",
598603
"module": module,
599604
"lineno": tb_lineno,

0 commit comments

Comments
 (0)