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.split does not handle . & .. properly #38593
Comments
The os.path.split() & posixpath.split() functions in my I'll demonstrate the Unix Python case (the Windows Example:
>python
Python 2.1.1
>>> posixpath.split('.')
('', '.')
>>> posixpath.split('..')
('', '..')
Yet:
>>> posixpath.split('./')
('..', '')
>>> posixpath.split('../')
('..', '') Now '.' really represents './', and '..' really The fix in posixpath.py for this is just to put a |
Logged In: YES I don't believe this behavior is a bug. os.path.split's task is to split the last component of a path from the other components, regardless of whether any of the components actually names a directory. Another property of os.path.split is that eventually this loop will terminate: |
Logged In: YES Ok, I see your points, but I have 2 points. Point 1: Point 2: So do I have a good Point #1, and more importantly do I have Curtis Siemens |
Logged In: YES OK-- so my statement of the "important property" of split The important point is that split shortens the path whenever You didn't respond to my point that os.path.split is about Let me also address your claim that because of this split I strongly believe this bug should be marked closed, |
Logged In: YES Ok, I like the statment, Ok, onto dirname/basename which are really the source of my |
Logged In: YES Interestingly, it appears that back in Python version 1.2, By version 1.4, the behavior had This change in the Python CVS was made by Guido himself, Since the behavior you are now proposing was one that Guido |
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: