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 os.path.commonprefix to work by directory components #32556
Comments
No description provided. |
splitting on os.sep isn't good enough for Windows (it supports both "/" and "\"). the correct way would be to split on either os.sep or os.altsep (if not None), or to normalize the path's before comparing them. except for this, I'm +0 on this one. |
Why use n - copy.copy(m)? It's much simpler to use n = m[:]. Note that dospath probably also has this. And macpath should have one. I'm +1 on fixing the functionality if it's indeed broken as Skip reports; haven't looked at the code in detail (except I noted the import copy). |
Guido asked: > Why use n - copy.copy(m)? It's much simpler to use n = m[:]. Just a brain fart. I will upload a revised patch. I will also try splitting on both os.sep and os.altsep as Fredrik indicated. |
This version of the patch tries splitting with os.sep then |
Check it in -- you already checked in the changes to the test! I propose to use m[:] instead of copy.copy(m), and not import the copy module. |
checked in |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: