Message188901
In Python 3.3 (I did not test with 3.4), sys.modules cannot be reassigned without breaking the import mechanism; while it works with Python <= 3.2.
Here is how to reproduce the bug:
progval@Andromede:/tmp$ mkdir test_imports
progval@Andromede:/tmp$ echo "from . import module" > test_imports/__init__.py
progval@Andromede:/tmp$ echo "print('foo')" > test_imports/module.py
progval@Andromede:/tmp$ python3.3
Python 3.3.1 (default, Apr 6 2013, 13:58:40)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.modules = dict(sys.modules)
>>> import test_imports
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "./test_imports/__init__.py", line 1, in <module>
from . import module
SystemError: Parent module 'test_imports' not loaded, cannot perform relative import
>>>
progval@Andromede:/tmp$ python3.2
Python 3.2.3 (default, May 6 2013, 01:46:35)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.modules = dict(sys.modules)
>>> import test_imports
foo
>>> |
|
Date |
User |
Action |
Args |
2013-05-11 08:23:33 | Valentin.Lorentz | set | recipients:
+ Valentin.Lorentz |
2013-05-11 08:23:33 | Valentin.Lorentz | set | messageid: <1368260613.85.0.746522318662.issue17953@psf.upfronthosting.co.za> |
2013-05-11 08:23:33 | Valentin.Lorentz | link | issue17953 messages |
2013-05-11 08:23:33 | Valentin.Lorentz | create | |
|