Message206433
I'm reopening this, since PEP 451 opens up new options for dealing with it (at least for loaders that export the PEP 451 APIs rather than only the legacy loader API, which now includes all the standard loaders other than the ones for builtins and extension modules)
The attached patch doesn't have an automated test and is quite rough around the edges (as the additional check for the parent being in sys.modules confuses a couple of the importlib tests), but it proves the concept by making the following work:
[ncoghlan@lancre py3k]$ cd ../play
[ncoghlan@lancre play]$ mkdir issue992389
[ncoghlan@lancre play]$ cat > issue992389/mod.py
from . import mod
print("Success!")
[ncoghlan@lancre play]$ python3 -c "import issue992389.mod"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "./issue992389/mod.py", line 1, in <module>
from . import mod
ImportError: cannot import name mod
[ncoghlan@lancre play]$ ../py3k/python -c "import issue992389.mod"
Success! |
|
Date |
User |
Action |
Args |
2013-12-17 13:47:35 | ncoghlan | set | recipients:
+ ncoghlan, tim.peters, loewis, jhylton, brett.cannon, dcjim, Rhamphoryncus, bronger, larry, eric.araujo, flox, sbt, eric.snow |
2013-12-17 13:47:35 | ncoghlan | set | messageid: <1387288055.74.0.676776868637.issue992389@psf.upfronthosting.co.za> |
2013-12-17 13:47:35 | ncoghlan | link | issue992389 messages |
2013-12-17 13:47:34 | ncoghlan | create | |
|