Skip to content

Fix ValueError when tracing across Windows drives#83

Merged
KaykCaputo merged 1 commit into
KaykCaputo:masterfrom
AnshBajpai05:fix/cross-drive-valueerror
Jul 8, 2026
Merged

Fix ValueError when tracing across Windows drives#83
KaykCaputo merged 1 commit into
KaykCaputo:masterfrom
AnshBajpai05:fix/cross-drive-valueerror

Conversation

@AnshBajpai05

Copy link
Copy Markdown
Contributor

Follow-up from #82, as discussed.

Symptom: on Windows, when the interpreter and the traced project live on different drives (e.g. Python on C:, project on F:), every call event prints

Error in oracletrace tracer: Paths don't have the same drive

and the run ends with No calls traced. Nothing can be traced at all in that setup — 10 of the existing tests also fail on such a machine.

Cause: os.path.commonpath raises ValueError for paths on different drives. _is_user_code calls it in three places (project root, stdlib, site-packages), inside the sys.setprofile callback, so the first cross-drive comparison poisons every event.

Fix: treat ValueError as 'not a match' at each comparison — a different drive can never be inside the project root, and can never be the stdlib or site-packages.

Tests: two regression tests that simulate the cross-drive ValueError portably (so they exercise the guards on Linux CI too). Both fail on master, pass with the fix. On my multi-drive Windows machine the full suite goes from 10 failures to green with this patch.

🤖 Generated with Claude Code

os.path.commonpath raises ValueError when its arguments sit on
different Windows drives. _is_user_code hit this in three places
(project root, stdlib, site-packages), and because it runs inside
the profile callback, one interpreter-on-C:/project-on-F: setup
killed tracing for every single call event.

A different drive can never be inside the project root, nor be the
stdlib or site-packages, so each comparison now treats ValueError
as 'not a match'.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@KaykCaputo KaykCaputo merged commit 2abed0a into KaykCaputo:master Jul 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants