-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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.splitext don't handle unix hidden file correctly #41522
Comments
I expected this.
>>> os.path.splitext('/path/to/.Hiddenfile')
('/path/to/.Hiddenfile', '')
but got this.
>>> os.path.splitext('/path/to/.Hiddenfile')
('/path/to/', '.Hiddenfile') |
Logged In: YES from test_posixpath.py :: self.assertEqual(posixpath.splitext(".ext"), ("", ".ext")) IMHO should then return (".ext",""). if this is desired :: if i<=p.rfind('/'):
return p, ''
else:
return p[:i], p[i:] should do |
Logged In: YES Interestingly, altering the behaviour of splitext in such a """ Personally I'm in favour of this change (on Unix it makes |
Logged In: YES -1 I hate to be a stick-in-the-mud, but the existing behaviour >>> os.path.splitext('a/b/c/foo.bar')
('a/b/c/foo', '.bar')
>>> os.path.splitext('a/b/c/f.oo.bar')
('a/b/c/f.oo', '.bar')
>>> os.path.splitext('a/b/c/.foo')
('a/b/c/', '.foo')
>>> os.path.splitext('a/b/c/.foo.txt')
('a/b/c/.foo', '.txt') Changing it would surely break somebody's code too, of course. |
1462106 is a patch, though perhaps not the latest. python-dev is currently debating whether to fix this behavior or maintain backwards-compatibility. That suggests that it at least won't be changed in a bugfix version (like 2.4.x), and the group should be changed to 2.6. |
After some discussion on python-dev, I fixed this in r54204. |
I've read parts of the python-dev discussions, but I don't agree with |
Alexandru: You commented on a closed issue. If you see any problem |
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: