Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
feb748d
feat(internal): add sys.monitoring multiplexer for Python 3.15
P403n1x87 Jul 22, 2026
74e27bc
chore(wrapping): add Python 3.15 wrapping context support
P403n1x87 Jul 22, 2026
bed77fe
typing: annotate monitoring tests
vlad-scherbich Jul 23, 2026
3cf7dcc
typing: annotate wrapping context for py3.15
vlad-scherbich Jul 23, 2026
30b3a96
Merge branch 'gab/315-monitoring-multiplexer' into chore/315-wrapping…
vlad-scherbich Jul 23, 2026
390557f
Merge branch 'main' into gab/315-monitoring-multiplexer
vlad-scherbich Jul 23, 2026
be123d3
fix(wrapping): use Optional for 3.9-compatible module annotations
vlad-scherbich Jul 23, 2026
53a0f7c
first round of bot comments
vlad-scherbich Jul 23, 2026
3d52304
fix(tests): use Union in test_unwrap for Python 3.9
vlad-scherbich Jul 23, 2026
bc9465d
second round of bot comments
vlad-scherbich Jul 23, 2026
c611c20
final round of bot comments
vlad-scherbich Jul 23, 2026
7a95814
Merge branch 'gab/315-monitoring-multiplexer' into chore/315-wrapping…
vlad-scherbich Jul 23, 2026
74b6d3d
fix(wrapping): harden 3.15 monitoring wrap registration
vlad-scherbich Jul 23, 2026
bbe7b09
chore: merge main into chore/315-wrapping-context
vlad-scherbich Aug 7, 2026
03e115a
Merge branch 'main' into chore/315-wrapping-context
vlad-scherbich Aug 8, 2026
b42170c
Merge branch 'main' into chore/315-wrapping-context
P403n1x87 Aug 13, 2026
8d1d128
address review comments
P403n1x87 Aug 14, 2026
a6165fd
address review comments
P403n1x87 Aug 18, 2026
0c8becf
uniform exc-on-return behaviour
P403n1x87 Aug 18, 2026
e530750
Merge remote-tracking branch 'origin/main' into chore/315-wrapping-co…
P403n1x87 Aug 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ddtrace/debugging/_function/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from ddtrace.debugging._function.discovery import FullyNamed
from ddtrace.internal.bytecode_injection import HookInfoType
from ddtrace.internal.bytecode_injection import HookType
from ddtrace.internal.bytecode_injection import eject_all_hooks
from ddtrace.internal.bytecode_injection import eject_hooks
from ddtrace.internal.bytecode_injection import inject_hooks
from ddtrace.internal.wrapping import get_function_code
Expand Down Expand Up @@ -89,5 +90,14 @@ def unwrap(self, function: FullyNamedContextWrappedFunction) -> None:

def restore_all(self) -> None:
"""Restore all the patched functions to their original form."""
for function, wrapping_context in list(self._wrapper_map.items()):
wrapping_context.unwrap()

for function, code in self._code_map.items():
# Restoring __code__ alone would leave 3.15+ line hooks (keyed by
# code object) still firing.
eject_all_hooks(function)
function.__code__ = code

self._code_map.clear()
self._wrapper_map.clear()
Loading
Loading