Message9678
Importation of modules with unicode names with non-ASCII characters should raise UnicodeEncodeError instead of java.lang.IllegalArgumentException.
$ cat test.py
# coding: utf-8
import sys
sys.path.append("/tmp")
module = __import__(u"ćśź")
print(module)
$ python2.7 test.py
Traceback (most recent call last):
File "test.py", line 4, in <module>
module = __import__(u"ćśź")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
$ jython2.7 test.py
Traceback (most recent call last):
File "test.py", line 4, in <module>
module = __import__(u"ćśź")
java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
at org.python.core.PyString.<init>(PyString.java:64)
at org.python.core.PyString.<init>(PyString.java:70)
at org.python.core.imp.find_module(imp.java:533)
at org.python.core.imp.import_next(imp.java:837)
at org.python.core.imp.import_module_level(imp.java:956)
at org.python.core.imp.importName(imp.java:1057)
at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
at org.python.core.PyObject.__call__(PyObject.java:461)
at org.python.core.PyObject.__call__(PyObject.java:465)
at org.python.pycode._pyx1.f$0(test.py:5)
at org.python.pycode._pyx1.call_function(test.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1374)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:299)
at org.python.util.jython.run(jython.java:367)
at org.python.util.jython.main(jython.java:142)
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Cannot create PyString with non-byte value |
|
Date |
User |
Action |
Args |
2015-03-19 12:52:50 | Arfrever | set | recipients:
+ Arfrever, zyasoft |
2015-03-19 12:52:50 | Arfrever | set | messageid: <1426769570.93.0.49850856864.issue2296@psf.upfronthosting.co.za> |
2015-03-19 12:52:50 | Arfrever | link | issue2296 messages |
2015-03-19 12:52:50 | Arfrever | create | |
|