Skip to content

Commit

Permalink
chore(internal): bytecode wrapping context
Browse files Browse the repository at this point in the history
We introduce a new mechanism of wrapping functions via a special context
manager that is capable of capturing return values as well. The goal is
to allow observability into the called functions, to have access to
local variables on exit. This approach has the extra benefit of not
introducing any extra frames in the call stack of the wrapped function.
  • Loading branch information
P403n1x87 committed May 14, 2024
1 parent f682826 commit 6fb1599
Show file tree
Hide file tree
Showing 3 changed files with 867 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ddtrace/internal/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,6 @@ def dis(self) -> None:

def __iter__(self) -> t.Iterator[bc.Instr]:
return iter(self._instrs)

def __len__(self) -> int:
return len(self._instrs)

0 comments on commit 6fb1599

Please sign in to comment.