-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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
os.path.relpath() assumes '//' root is equivalent to '/' #92737
Comments
Cross-platform POSIX applications should not assume that "//foo" is the same as "/foo". A path that begins with two slashes is reserved in POSIX for use by implementations. Linux handles "//foo" the same as "/foo". Cygwin, on the other hand, supports UNC paths such as "//server/share". A |
@eryksun Would you still think adding a |
I'd argue that The implementation should call |
@barneygale Would in this case fixing |
It's a bugfix, so not necessarily. Quoth PEP 387:
But if we think fixing it will cause sadness, we could skip backporting or perhaps hide it behind an argument as Eryk suggests. |
…quivalent to '/'.
Bug report
pathlib's Path.relative_to() and os.path.relpath(), the two have different behavior: On Linux os.path.relpath() understands double-slash in path is same as single slash, but Path.relative_to() does not.
For example,
pytest issue pytest-dev/pytest#9894 relates to this.
Your environment
Linked PRs
The text was updated successfully, but these errors were encountered: