[Python-Dev] Issue #11051: system calls per import

"Martin v. Löwis" martin at v.loewis.de
Sun Jan 30 10:40:52 CET 2011


> Python 3.1 does already test many filenames, but with Python 3.2, it is
> even worse.
> 
> For each directory in sys.path, it tries 9 suffixes: '',
> '.cpython-32m.so', 'module.cpython-32m.so', '.abi3.so',
> 'module.abi3.so', '.so', 'module.so', '.py', '.pyc'.
> 
> I don't understand why it tests so much .so suffixes. And why it does
> test with and without "module".

The many extensions have been specified in PEP 3149. The PEP also specifies

# This "tag" will appear between the module base name and the operation
# file system extension for shared libraries.

which apparently meant that the existing mechanism is extended to add
the tag.

The support for both the "short extension" (i.e. ".so") and "long
extension" (i.e. "module.so") goes back to r4297 (Python 1.1),
when the short extension was added as an alternative to the long
extension. The original module suffix was defined in r3518 when
dynamic extension modules got supported, as either "module.so"
(SUN_SHLIB) or "module.o" (dl_loadmod, apparently Irix).

Regards,
Martin


More information about the Python-Dev mailing list