Message9266

Author Arfrever
Recipients Arfrever, jeff.allen
Date 2014-12-27.04:43:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1419655381.96.0.447020767542.issue2239@psf.upfronthosting.co.za>
In-reply-to
Content
os.listdir() is broken with unicode characters in filenames, probably since one of the following revisions, which introduced 'throw new IllegalArgumentException("Cannot create PyString with non-byte value")' lines:
https://hg.python.org/jython/rev/f0c63b42e552
https://hg.python.org/jython/rev/521823de34a5

CPython 2.7 works correctly.

$ mkdir /tmp/some_dir
$ touch /tmp/some_dir/ś
$ python2.7 -c 'import os; print(os.listdir("/tmp/some_dir"))'
['\xc5\x9b']
$ jython2.7 -c 'import os; print(os.listdir("/tmp/some_dir"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
        at org.python.core.PyString.<init>(PyString.java:57)
        at org.python.core.PyString.<init>(PyString.java:63)
        at org.python.core.PyString.createInstance(PyString.java:765)
        at org.python.modules.posix.PosixModule.listdir(PosixModule.java:499)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
$
History
Date User Action Args
2014-12-27 04:43:02Arfreversetrecipients: + Arfrever, jeff.allen
2014-12-27 04:43:01Arfreversetmessageid: <1419655381.96.0.447020767542.issue2239@psf.upfronthosting.co.za>
2014-12-27 04:43:01Arfreverlinkissue2239 messages
2014-12-27 04:43:00Arfrevercreate