From 693c1f1bb42ac9a1b6ccf1e09290d043ece51c3f Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Mon, 21 Jul 2025 12:15:03 +0200 Subject: [PATCH] fix: Fix `abs_path` bug in `serialize_frame` Fixes #4587 --- sentry_sdk/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index 595bbe0cf3..3b0ab8d746 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -591,9 +591,14 @@ def serialize_frame( if tb_lineno is None: tb_lineno = frame.f_lineno + try: + os_abs_path = os.path.abspath(abs_path) if abs_path else None + except Exception: + os_abs_path = None + rv = { "filename": filename_for_module(module, abs_path) or None, - "abs_path": os.path.abspath(abs_path) if abs_path else None, + "abs_path": os_abs_path, "function": function or "", "module": module, "lineno": tb_lineno,