Skip to content

Commit ce68cad

Browse files
committed
fix tracer for static methods
1 parent eb9e0c6 commit ce68cad

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

codeflash/tracer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,12 @@ def tracer_logic(self, frame: FrameType, event: str) -> None: # noqa: PLR0911
346346
# someone can override the getattr method and raise an exception. I'm looking at you wrapt
347347
return
348348

349+
# Extract class name from co_qualname for static methods that lack self/cls
350+
if class_name is None and "." in getattr(code, "co_qualname", ""):
351+
qualname_parts = code.co_qualname.split(".")
352+
if len(qualname_parts) >= 2:
353+
class_name = qualname_parts[-2]
354+
349355
try:
350356
function_qualified_name = f"{file_name}:{code.co_qualname}"
351357
except AttributeError:

0 commit comments

Comments
 (0)