Message167967
Since CPython 2.5, relative imports could be used from __init__.so package modules. This stopped working in CPython 3.3.
This is a follow-up ticket to issue15576.
This feature is exercised by Cython's initial_file_path test, which now gives this result:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "__init__.py", line 8, in init my_test_package (my_test_package/__init__.c:1032)
SystemError: Parent module 'my_test_package' not loaded, cannot perform relative import
It is meant to check that Cython provides a fake __path__ for the package module for the init function (as long as issue13429 isn't resolved). With that, relative imports worked before.
The test code is here, failing in line 21 (each section is a separate file), when it tries to do a relative import at the module level, i.e. at module init time.
https://github.com/cython/cython/blob/master/tests/run/initial_file_path.srctree
I'm running the test like this:
python3 runtests.py --no-cpp --no-pyregr --no-unit --debug -vv initial_file_path
I also tried printing sys.modules and the package really isn't registered there yet at the time of the import. |
|
Date |
User |
Action |
Args |
2012-08-11 15:02:05 | scoder | set | recipients:
+ scoder |
2012-08-11 15:02:05 | scoder | set | messageid: <1344697325.25.0.880049566038.issue15623@psf.upfronthosting.co.za> |
2012-08-11 15:02:04 | scoder | link | issue15623 messages |
2012-08-11 15:02:03 | scoder | create | |
|