Skip to content

Commit 45733c9

Browse files
committed
fix line-lazy wrapping compat
1 parent 60514e4 commit 45733c9

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

ddtrace/internal/utils/inspection.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ def undecorated(f: FunctionType, name: str, path: Path) -> FunctionType:
5050
def match(g):
5151
return g.__code__.co_name == name and resolved_code_origin(g.__code__) == path
5252

53-
if _isinstance(f, FunctionType) and match(f):
54-
return f
55-
5653
seen_functions = {f}
5754
q = deque([f]) # FIFO: use popleft and append
5855

tests/debugging/test_debugger.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,27 @@ def test_debugger_line_probe_on_wrapped_function(stuff):
621621
assert snapshot.probe.probe_id == "line-probe-wrapped-method"
622622

623623

624+
def test_debugger_line_probe_on_lazy_wrapped_function(stuff):
625+
from ddtrace.internal.wrapping.context import LazyWrappingContext
626+
627+
LazyWrappingContext(stuff.durationstuff).wrap()
628+
629+
with debugger() as d:
630+
d.add_probes(
631+
create_snapshot_line_probe(
632+
probe_id="line-probe-lazy-wrapping",
633+
source_file="tests/submod/stuff.py",
634+
line=133,
635+
condition=None,
636+
)
637+
)
638+
639+
stuff.durationstuff(0)
640+
641+
with d.assert_single_snapshot() as snapshot:
642+
assert snapshot.probe.probe_id == "line-probe-lazy-wrapping"
643+
644+
624645
def test_probe_status_logging(remote_config_worker, stuff):
625646
assert remoteconfig_poller.status == ServiceStatus.STOPPED
626647

0 commit comments

Comments
 (0)