[pypy-issue] Issue #2524: Regression: __import__ does not allow unicode strings in fromlist (pypy/pypy)

Eli Oxman issues-reply at bitbucket.org
Wed Mar 29 09:28:16 EDT 2017


New issue 2524: Regression: __import__ does not allow unicode strings in fromlist
https://bitbucket.org/pypy/pypy/issues/2524/regression-__import__-does-not-allow

Eli Oxman:

On regular Python 2.7 I see the following behavior:

```
>>> main_module = __import__('foo', fromlist=[u'bar'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named foo
```

On Pypy 5.6 I got the same behavior, but on Pypy 5.7 I get:
```
>>>> main_module = __import__('foo', fromlist=[u'bar'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'fromlist' items must be str, not unicode
```

I believe it should be possible to import with unicode literals in the `fromlist`.
In particular I stumbled upon this when using a 3rd party library that uses `from __future__ import unicode_literals`.




More information about the pypy-issue mailing list