Skip to content

Commit 0f066c0

Browse files
committed
Merge branch 'granular-async-instrumentation' of https://github.com/codeflash-ai/codeflash into granular-async-instrumentation
2 parents 1fe7c04 + 91b8902 commit 0f066c0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

codeflash/code_utils/codeflash_wrap_decorator.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ def _extract_class_name_tracer(frame_locals: dict[str, Any]) -> str | None:
5757

5858

5959
def _get_module_name_cf_tracer(frame: FrameType | None) -> str:
60-
with contextlib.suppress(Exception):
60+
try:
6161
test_module = inspect.getmodule(frame)
62-
if test_module and hasattr(test_module, "__name__"):
63-
return test_module.__name__
62+
except Exception:
63+
test_module = None
64+
65+
if test_module is not None:
66+
module_name = getattr(test_module, "__name__", None)
67+
if module_name is not None:
68+
return module_name
6469

6570
if frame is not None:
6671
return frame.f_globals.get("__name__", "unknown_module")

0 commit comments

Comments
 (0)