Message160105
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 |
|
Date |
User |
Action |
Args |
2012-05-06 19:24:32 | brett.cannon | set | recipients:
+ brett.cannon, pitrou, nadeem.vawda, Arfrever, skrah, eric.snow |
2012-05-06 19:24:32 | brett.cannon | set | messageid: <1336332272.74.0.0239666112587.issue14583@psf.upfronthosting.co.za> |
2012-05-06 19:24:32 | brett.cannon | link | issue14583 messages |
2012-05-06 19:24:32 | brett.cannon | create | |
|