From 3c0c6b78dff8e7b0995b0e301939d4e9c3842542 Mon Sep 17 00:00:00 2001 From: Olli Lupton Date: Mon, 4 Dec 2023 14:19:38 +0100 Subject: [PATCH] Use qualified name if possible. --- jax/_src/source_info_util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jax/_src/source_info_util.py b/jax/_src/source_info_util.py index efec6cd2e561..4aef332eeb97 100644 --- a/jax/_src/source_info_util.py +++ b/jax/_src/source_info_util.py @@ -147,11 +147,12 @@ def raw_frame_to_frame(code: types.CodeType, lasti: int) -> Frame: loc = xla_client.Traceback.code_addr2location(code, lasti) start_line, start_column, end_line, end_column = loc return Frame(file_name=code.co_filename, - function_name=code.co_name, + function_name=code.co_qualname, start_line=start_line, start_column=start_column, end_line=end_line, end_column=end_column) else: def raw_frame_to_frame(code: types.CodeType, lasti: int) -> Frame: + # pre-3.11 co_qualname does not exist, use co_name return Frame(file_name=code.co_filename, function_name=code.co_name, start_line=xla_client.Traceback.code_addr2line(code, lasti),