]> granicus.if.org Git - python/commit
[3.5] Backport bpo-30876 (GH-2639), bpo-18018 and bpo-26367. (#2677)
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 23 Jul 2017 06:44:05 +0000 (09:44 +0300)
committerGitHub <noreply@github.com>
Sun, 23 Jul 2017 06:44:05 +0000 (09:44 +0300)
commitc824cc8426a16dd9f3949a3ed135523d37787bae
tree2653e36c69b6e77eafc4d0b8346f0800d9a80a06
parente78dc0aaf03cd98373910150c2d35418cf938254
[3.5] Backport bpo-30876 (GH-2639), bpo-18018 and bpo-26367. (#2677)

* bpo-30876: Relative import from unloaded package now reimports the package
instead of failing with SystemError.

Relative import from non-package now fails with ImportError rather than
SystemError.
(cherry picked from commit 8a9cd20edca7d01b68292036029ae3735ce65edd)

* bpo-18018: Import raises ImportError instead of SystemError if a relative
import is attempted without a known parent package.

* bpo-26367: importlib.__init__() raises ImportError like
builtins.__import__() when ``level`` is specified but without an accompanying
package specified.
Lib/importlib/_bootstrap.py
Lib/test/test_import/__init__.py
Lib/test/test_import/data/package2/submodule1.py [new file with mode: 0644]
Lib/test/test_import/data/package2/submodule2.py [new file with mode: 0644]
Lib/test/test_importlib/import_/test___package__.py
Lib/test/test_importlib/import_/test_relative_imports.py
Misc/NEWS.d/next/Core and Builtins/2017-07-11-06-31-32.bpo-30876.x35jZX.rst [new file with mode: 0644]
Python/import.c
Python/importlib.h