Skip to content

Commit d9225cf

Browse files
[mq] [skip ddci] working branch - merge 7e34962 on top of main at e6513ea
{"baseBranch":"main","baseCommit":"e6513eaaf42e37f4bbd194349846be01527586d3","createdAt":"2026-08-28T10:46:53.208055Z","headSha":"7e3496229f4ca409c11bde49ce59ca9e2dc4e54d","id":"e3a2a866-bc30-4fa0-bf33-87d1fb83efb5","mergeMethod":"squash","priority":"200","pullRequestNumber":"17849","queuedAt":"2026-08-28T10:46:53.206453Z","retryAttempt":"3","status":"STATUS_QUEUED"}
2 parents c38f937 + 7e34962 commit d9225cf

16 files changed

Lines changed: 1604 additions & 629 deletions

File tree

ddtrace/debugging/_function/store.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ddtrace.debugging._function.discovery import FullyNamed
88
from ddtrace.internal.bytecode_injection import HookInfoType
99
from ddtrace.internal.bytecode_injection import HookType
10+
from ddtrace.internal.bytecode_injection import eject_all_hooks
1011
from ddtrace.internal.bytecode_injection import eject_hooks
1112
from ddtrace.internal.bytecode_injection import inject_hooks
1213
from ddtrace.internal.wrapping import get_function_code
@@ -89,5 +90,14 @@ def unwrap(self, function: FullyNamedContextWrappedFunction) -> None:
8990

9091
def restore_all(self) -> None:
9192
"""Restore all the patched functions to their original form."""
93+
for function, wrapping_context in list(self._wrapper_map.items()):
94+
wrapping_context.unwrap()
95+
9296
for function, code in self._code_map.items():
97+
# Restoring __code__ alone would leave 3.15+ line hooks (keyed by
98+
# code object) still firing.
99+
eject_all_hooks(function)
93100
function.__code__ = code
101+
102+
self._code_map.clear()
103+
self._wrapper_map.clear()

0 commit comments

Comments
 (0)