-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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.normpath doesn't preserve unicode #50077
Comments
In the Python 2.x branch, os.path.normpath will sometimes return a str This happens specifically when it throws away all string data and >>> os.path.normpath(u'')
'.'
>>> os.path.normpath(u'.')
'.'
>>> os.path.normpath(u'/')
'/' This is a problem if working with code which expects all strings to be I have attached patches (with test cases) for posixpath and ntpath which >>> os.path.normpath(u'')
u'.'
>>> os.path.normpath(u'.')
u'.'
>>> os.path.normpath(u'/')
u'/' I tried it on os2emxpath and plat-riscos/riscospath (the other two |
Thanks for the patch, I tried it on Linux and it seems to solve the problem. A few comments about it:
|
Thanks Ezio. I've updated the patch to incorporate your suggestions. Note that I too have only tested it on Linux, but I tested both I'm not sure if using assertTrue(isinstance ...) is better than But oh well, I made the change anyway as most test cases use isinstance. |
assertTrue() also accepts a 'msg' argument where to explain what went |
Also, assertTrue has an alias failUnless which I personally find more |
failUnless is deprecated in Python3.1 1. The assert* methods are |
Fixed in r77442 (trunk) and r77443 (release26-maint), thanks! |
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: