New issue 3112: PyPy2 doesn't handle Unicode entries with non-ASCII characters
in `sys.path`
https://bitbucket.org/pypy/pypy/issues/3112/pypy2-doesnt-handle-unicode-entries-with
Unknown:
It seems PyPy2 requires programmatically added `sys.path` entries to either be
ASCII or encoded using the system encoding. Other Python interpreters I’ve
tested \(Python 2, IronPython, Jython, and naturally Python 3\) all accept also
Unicode paths.
```python
Python 2.7.12 (aff251e54385, Nov 09 2016, 18:02:49)
[PyPy 5.6.0 with GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys
>>>> sys.path.insert(0, u'\xe4'.encode('UTF-8'))
>>>> import nonexisting
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named nonexisting
>>>> sys.path.insert(0, u'\xe4')
>>>> import nonexisting
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 0:
ordinal not in range(128)
```
This isn’t a huge problem but makes writing code that works in all Python
interpreters a bit harder. That’s especially true when [Jython nowadays uses
Unicode entries](https://bugs.jython.org/issue2820) in `sys.path` and only
accepts bytes if they are encoded using UTF-8 regardless the encoding. All
interpreters supporting Unicode entries would be nice.
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue