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 brett.cannon
Recipients Arfrever, brett.cannon, eric.snow, nadeem.vawda, pitrou, skrah
Date 2012-05-06.19:24:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1336332272.74.0.0239666112587.issue14583@psf.upfronthosting.co.za>
In-reply-to
Content
So I was going to try to figure out the logic, so I manually created the test files to start debugging, but I didn't get the ImportError but instead the 1/0 error for the relative import. Maybe it's specific to lack of threads or the change you made? I mean if that's how it has always worked then I'm not arguing that it's wrong, just that it's a weird side-effect:


>>> import pkg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 977, in _find_and_load
  File "<frozen importlib._bootstrap>", line 596, in load_module
  File "<frozen importlib._bootstrap>", line 262, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 484, in _load_module
  File "./pkg/__init__.py", line 3, in <module>
    1/0
ZeroDivisionError: division by zero
[70552 refs]
>>> import sys
[70554 refs]
>>> sys.modules['pkg']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'pkg'
[70462 refs]
>>> sys.modules['pkg.module']
<module 'pkg.module' from './pkg/module.py'>
[70465 refs]
>>> with open('pkg/__init__.py') as file: print(file.read())
... 
from . import module
#import pkg.module
1/0
History
Date User Action Args
2012-05-06 19:24:32brett.cannonsetrecipients: + brett.cannon, pitrou, nadeem.vawda, Arfrever, skrah, eric.snow
2012-05-06 19:24:32brett.cannonsetmessageid: <1336332272.74.0.0239666112587.issue14583@psf.upfronthosting.co.za>
2012-05-06 19:24:32brett.cannonlinkissue14583 messages
2012-05-06 19:24:32brett.cannoncreate