diff options
author | Milan Oberkirch <zvyn@oberkirch.org> | 2017-06-14 21:34:50 (GMT) |
---|---|---|
committer | Brett Cannon <brettcannon@users.noreply.github.com> | 2017-06-14 21:34:50 (GMT) |
commit | 8c3f05e9f0f0b30a3d4a2433e92471794d8258af (patch) | |
tree | 57f6ae60b1701bf4ca4be1f9db1afce1e2bea795 /Doc | |
parent | 32fd874afe55e396e3c9a5af35e7bb3d8e0b8f02 (diff) | |
download | cpython-8c3f05e9f0f0b30a3d4a2433e92471794d8258af.zip cpython-8c3f05e9f0f0b30a3d4a2433e92471794d8258af.tar.gz cpython-8c3f05e9f0f0b30a3d4a2433e92471794d8258af.tar.bz2 |
bpo-30436: Raise ModuleNotFoundError for importlib.util.find_spec() when parent isn't a package (GH-1899)
Previously AttributeError was raised, but that's not very reflective of the fact that the requested module can't be found since the specified parent isn't actually a package.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/importlib.rst | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 1df6130..45a02e5 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1215,6 +1215,11 @@ an :term:`importer`. .. versionadded:: 3.4 + .. versionchanged:: 3.7 + Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if + **package** is in fact not a package (i.e. lacks a :attr:`__path__` + attribute). + .. function:: module_from_spec(spec) Create a new module based on **spec** and |