From 10b3592f986adae03cdc210ee1120bb74e03e051 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Fri, 8 Nov 2024 16:01:59 -0800 Subject: [PATCH] Catch TypeError together with OSError when inspect source (#115) --- src/objprint/frame_analyzer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objprint/frame_analyzer.py b/src/objprint/frame_analyzer.py index a3a55ea..3997812 100644 --- a/src/objprint/frame_analyzer.py +++ b/src/objprint/frame_analyzer.py @@ -53,7 +53,7 @@ def get_executing_function_call_str(self, frame: FrameType) -> Optional[str]: if module is None: return None source = inspect.getsource(module) - except OSError: + except (OSError, TypeError): return None return ast.get_source_segment(source, node)