diff options
author | Brett Cannon <brett@python.org> | 2012-06-16 00:00:53 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-06-16 00:00:53 (GMT) |
commit | ea0b8239401123fa7f41c74f6fc9ded1cf74088a (patch) | |
tree | 6d5afa0b55c1c5e1e39770d062b25d81a231535b /Doc/library/importlib.rst | |
parent | 0450c9ed52deccd087c56b4da36f02c800c604a5 (diff) | |
download | cpython-ea0b8239401123fa7f41c74f6fc9ded1cf74088a.zip cpython-ea0b8239401123fa7f41c74f6fc9ded1cf74088a.tar.gz cpython-ea0b8239401123fa7f41c74f6fc9ded1cf74088a.tar.bz2 |
Issue #14938: importlib.abc.SourceLoader.is_package() now takes the
module name into consideration when determining whether a module is a
package or not. This prevents importing a module's __init__ module
directly and having it considered a package, which can lead to
duplicate sub-modules.
Thanks to Ronan Lamy for reporting the bug.
Diffstat (limited to 'Doc/library/importlib.rst')
-rw-r--r-- | Doc/library/importlib.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 35a99bf..9dc6ed1 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -351,8 +351,10 @@ are also provided to help in implementing the core ABCs. .. method:: is_package(self, fullname) Concrete implementation of :meth:`InspectLoader.is_package`. A module - is determined to be a package if its file path is a file named - ``__init__`` when the file extension is removed. + is determined to be a package if its file path (as provided by + :meth:`ExecutionLoader.get_filename`) is a file named + ``__init__`` when the file extension is removed **and** the module name + itself does not end in ``__init__``. .. class:: PyLoader |