This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Rhamphoryncus, brett.cannon, bronger, dcjim, eric.araujo, eric.snow, flox, jhylton, larry, loewis, ncoghlan, sbt, tim.peters
Date 2013-12-17.13:47:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1387288055.74.0.676776868637.issue992389@psf.upfronthosting.co.za>
In-reply-to
Content
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!
History
Date User Action Args
2013-12-17 13:47:35ncoghlansetrecipients: + ncoghlan, tim.peters, loewis, jhylton, brett.cannon, dcjim, Rhamphoryncus, bronger, larry, eric.araujo, flox, sbt, eric.snow
2013-12-17 13:47:35ncoghlansetmessageid: <1387288055.74.0.676776868637.issue992389@psf.upfronthosting.co.za>
2013-12-17 13:47:35ncoghlanlinkissue992389 messages
2013-12-17 13:47:34ncoghlancreate