[issue15576] importlib: ExtensionFileLoader not used to load packages from __init__.so files

Stefan Behnel report at bugs.python.org
Tue Aug 7 20:35:50 CEST 2012


New submission from Stefan Behnel:

The new importlib shows a regression w.r.t. previous CPython versions. It no longer recognises an "__init__.so" file as a package. All previous CPython versions have always tested first for an extension file before testing for a .py/.pyc file. The new importlib explicitly excludes the ExtensionFileLoader from loading packages. See importlib/_bootstrap.py, line 1579 onwards:

   1579 def _get_supported_file_loaders():
   1580     """Returns a list of file-based module loaders.
   1581 
   1582     Each item is a tuple (loader, suffixes, allow_packages).
   1583     """
   1584     extensions = ExtensionFileLoader, _imp.extension_suffixes(), False    # <== bug here
   1585     source = SourceFileLoader, SOURCE_SUFFIXES, True
   1586     bytecode = SourcelessFileLoader, BYTECODE_SUFFIXES, True
   1587     return [extensions, source, bytecode]

(BTW, I'm not sure what to file this bug against - "Interpreter Core" or "Library"?)

----------
components: Library (Lib)
messages: 167630
nosy: scoder
priority: normal
severity: normal
status: open
title: importlib: ExtensionFileLoader not used to load packages from __init__.so files
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15576>
_______________________________________


More information about the Python-bugs-list mailing list