Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 9 additions & 5 deletions ddtrace/debugging/_probe/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,16 @@ def _resolve_source_file(_path: str) -> Optional[Path]:
if path.is_file():
return path.resolve()

max_resolved_path = None
for relpath in (path.relative_to(_) for _ in path.parents):
resolved_path = _resolve(relpath)
if resolved_path is not None:
return resolved_path

return None
if (resolved_path := _resolve(relpath)) is None:
continue
if max_resolved_path is None:
max_resolved_path = resolved_path
elif len(resolved_path.parts) > len(max_resolved_path.parts):
max_resolved_path = resolved_path

return max_resolved_path


MAXLEVEL = 2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
dynamic instrumentation: fix issue with line probes matching the wrong
source file when multiple source files from different Python path entries
share the same name.
Loading