-
-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix[ux]: fix relpath compiler panic on windows #4228
base: master
Are you sure you want to change the base?
Conversation
fix a bug where relpath raises an exception on window, when the source path and the destination path are on different drives.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4228 +/- ##
==========================================
- Coverage 91.35% 90.36% -0.99%
==========================================
Files 109 109
Lines 15637 15641 +4
Branches 3443 3443
==========================================
- Hits 14285 14134 -151
- Misses 920 1043 +123
- Partials 432 464 +32 ☔ View full report in Codecov by Sentry. |
try: | ||
return os.path.relpath(path) | ||
except ValueError: | ||
# on Windows, if path and curdir are on different drives, an exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the path be an absolute path in this scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I'm not sure about this
the reported issue targeted builtins, which use __path__,
which is absolute, and thus, the approach should work. although safe_relpath
which returns an abs path is a bit weird
but it might be that a relative path is in search paths, right? And that path could reference a different drive causing the exception. but in that case it's likely a user error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relpath is also used even if a different search path is used to resolve a path, for instance for error reporting it is used to report relative to the user's current directory. but on windows if you can't construct the relpath, you can't construct the relpath
fix a bug where relpath raises an exception on window, when the source path and the destination path are on different drives.
What I did
fix #4227
How I did it
How to verify it
Commit message
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)
Description for the changelog
Cute Animal Picture