This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年08月09日 12:06 by giampaolo.rodola, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| statvfs.patch | giampaolo.rodola, 2013年08月09日 12:06 | |||
| issue18695-2.patch | giampaolo.rodola, 2014年01月22日 19:47 | |||
| issue18695-3.patch | giampaolo.rodola, 2014年01月22日 20:48 | |||
| Messages (16) | |||
|---|---|---|---|
| msg194726 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2013年08月09日 12:06 | |
From: https://code.google.com/p/psutil/issues/detail?id=416 # -*- coding: utf-8 -*- from __future__ import unicode_literals import os, errno name = "ƒőő" try: os.mkdir(name) except OSError as err: if err.errno != errno.EEXIST: raise os.statvfs(name) The script above works fine on Python 3.3 but on 2.7 you'll get: Traceback (most recent call last): File "foo.py", line 10, in <module> os.statvfs(name) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128) Patch in attachment fixes the issue. |
|||
| msg194764 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年08月09日 20:17 | |
Functions such as rename(), popen(), mkfifo(), mknod(), etc have the same issue. |
|||
| msg194774 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年08月09日 20:47 | |
> The script above works fine on Python 3.3 but on 2.7 you'll get: ... Cool, you now have a good reason to upgrade to Python 3 ;-) I'm not sure that it's a good idea to invest time on fixing Unicode issues in Python 2, especially in a minor version (Python 2.7.x). |
|||
| msg194783 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2013年08月10日 02:44 | |
> I'm not sure that it's a good idea to invest time on fixing Unicode > issues in Python 2, especially in a minor version (Python 2.7.x). I admit I sort of share the same doubts, but considering 2.7 a "minor python version", especially at this point, would be a mistake. |
|||
| msg194788 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年08月10日 09:47 | |
2.7.x is a minor version, not 2.7. We fixed Unicode issues in Python 2 bugfixes many times. |
|||
| msg208114 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2014年01月14日 21:17 | |
Giampaolo, do you want to provide a test? |
|||
| msg208844 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2014年01月22日 19:47 | |
Attached patch includes tests. I took test_sax.py as an example. |
|||
| msg208847 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2014年01月22日 20:19 | |
While I'm at it I'm going to fix also mkfifo(), mknod() and others. Hold on a bit more. |
|||
| msg208849 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2014年01月22日 20:48 | |
Ok, patch in attachment fixes mkfifo(), mknod() and statvfs() and also includes Unicode tests for all os module's path-related functions. |
|||
| msg208853 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2014年01月22日 21:38 | |
You have eaten "return NULL;" in posix_mkfifo. "from test.test_support import TESTFN_UNICODE, TESTFN_ENCODING" can fail. The simplest solution is just initialize them to None by default in test_support. If TESTFN_UNICODE.encode(TESTFN_ENCODING) fails (on POSIX locale), it will be better to run tests with unicode(TESTFN, 'ascii') than skip them. Tests should check that results for unicode filename is same as for str filename. As far as Victor have doubts, we should ask Benjamin. |
|||
| msg208857 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2014年01月22日 22:24 | |
> As far as Victor have doubts, we should ask Benjamin. Well, if you begin to patch some os functions, we will find much functions which don't support Unicode path. I prefer to consider that Python 2 doesn't support Unicode filenames to avoid bugs. If you want to support Unicode filename, we will have to modify a lot of code. What's the point since Python 3 has a very good support of Unicode? Much better than Python 2? |
|||
| msg208959 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2014年01月23日 15:25 | |
Either way it's fine with me. Regardless I think these tests have some value because all those os functions are not currently tested so it might makes sense to apply Serhiy's suggestions and port them to Python 3.4. |
|||
| msg219038 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2014年05月24日 12:28 | |
BDFL says (http://permalink.gmane.org/gmane.comp.python.devel/146074): """Given that the claim "Python 2 doesn't support Unicode filenames" is factually incorrect (in Python 2.7, most filesystem calls in fact do support Unicode, at least on some platforms), I think individual functions in the os module that are found lacking should be considered bugs, and if someone goes through the effort to supply an otherwise acceptable fix, we shouldn't reject it on the basis that we don't want to consider supporting Unicode filenames.""" |
|||
| msg219048 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2014年05月24日 17:00 | |
Ok, I will go on then. > You have eaten "return NULL;" in posix_mkfifo. What do you mean? > If TESTFN_UNICODE.encode(TESTFN_ENCODING) fails (on POSIX locale), it will be better to run tests with > unicode(TESTFN, 'ascii') than skip them. Agreed. > Tests should check that results for unicode filename is same as for str filename. What do you mean? Can you provide an example? |
|||
| msg219054 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2014年05月24日 20:50 | |
> > You have eaten "return NULL;" in posix_mkfifo. > What do you mean? You deleted "return NULL;" after "if (!PyArg_ParseTuple(...))" in the posix_mkfifo() function. > > Tests should check that results for unicode filename is same as for str > > filename. > What do you mean? Can you provide an example? For example test_statvfs should check that os.statvfs(TESTFN_UNICODE) == os.statvfs(TESTFN_UNICODE_ENCODED) (where TESTFN_UNICODE_ENCODED is relevant 8-bit str). |
|||
| msg370467 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2020年05月31日 14:42 | |
Python 2.7 is no longer supported. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:49 | admin | set | github: 62895 |
| 2020年05月31日 14:42:33 | serhiy.storchaka | set | status: open -> closed resolution: out of date messages: + msg370467 stage: test needed -> resolved |
| 2014年05月24日 20:50:17 | serhiy.storchaka | set | messages: + msg219054 |
| 2014年05月24日 17:00:02 | giampaolo.rodola | set | messages: + msg219048 |
| 2014年05月24日 12:28:19 | serhiy.storchaka | set | messages: + msg219038 |
| 2014年01月23日 15:25:11 | giampaolo.rodola | set | messages: + msg208959 |
| 2014年01月22日 22:24:22 | vstinner | set | messages: + msg208857 |
| 2014年01月22日 21:38:38 | serhiy.storchaka | set | assignee: giampaolo.rodola messages: + msg208853 nosy: + benjamin.peterson |
| 2014年01月22日 20:48:10 | giampaolo.rodola | set | files:
+ issue18695-3.patch messages: + msg208849 |
| 2014年01月22日 20:19:14 | giampaolo.rodola | set | messages: + msg208847 |
| 2014年01月22日 19:47:42 | giampaolo.rodola | set | files:
+ issue18695-2.patch messages: + msg208844 |
| 2014年01月15日 06:25:14 | Arfrever | set | nosy:
+ Arfrever |
| 2014年01月14日 21:17:58 | serhiy.storchaka | set | type: behavior messages: + msg208114 stage: test needed |
| 2013年08月10日 09:47:34 | serhiy.storchaka | set | messages: + msg194788 |
| 2013年08月10日 02:44:24 | giampaolo.rodola | set | messages: + msg194783 |
| 2013年08月09日 20:47:49 | vstinner | set | messages: + msg194774 |
| 2013年08月09日 20:17:22 | serhiy.storchaka | set | nosy:
+ vstinner, serhiy.storchaka messages: + msg194764 |
| 2013年08月09日 12:06:43 | giampaolo.rodola | create | |