Fix ValueError when tracing across Windows drives#83
Merged
KaykCaputo merged 1 commit intoJul 8, 2026
Conversation
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
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 onF:), every call event printsand 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.commonpathraisesValueErrorfor paths on different drives._is_user_codecalls it in three places (project root, stdlib, site-packages), inside thesys.setprofilecallback, so the first cross-drive comparison poisons every event.Fix: treat
ValueErroras '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
ValueErrorportably (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