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

Victor Stinner victor.stinner at haypocalc.com
Sun Jan 30 17:35:45 CET 2011

Le dimanche 30 janvier 2011 à 22:52 +1000, Nick Coghlan a écrit :
> On Sun, Jan 30, 2011 at 7:25 PM, Georg Brandl <georg at python.org> wrote:
> >> And why it does test with and without "module".
> >
> > Because it always did (there's a thing called backwards compatibility.)
> >
> > This is of course probably the obvious one to start a deprecation process.
> But why do we check the long suffix for the *new* extension module
> naming variants from PEP 3149 and PEP 384? Those are completely new,
> so there's no backwards compatibility argument there.

My implicit question was: can we limit the number of tested suffixes? I
see two candidates: remove 'module.cpython-32m.so' ('.cpython-32m.so'
should be enough) and 'module.abi3.so' ('.abi3.so' should be enough).

And the real question is: should we change that before 3.2 final? If we
don't change that in 3.2, it will be harder to change it later (but it
is still possible).

Limit the number of suffixes is maybe not the right solution to limit
the number of system calls at startup. We can imagine alternatives:

 * remember the last filename when loading a module and retry this
filename first
 * specify that a module is a Python system module and should only be
loaded from "system directories"
 * specify the module type (directory, .py file, dynamic library, ...)
when loading a module
 * (or a least remember the module type and retry this type first)
 * etc.

We should find a compromise between speed (limit the number of system
calls) and the usability of Python modules.


More information about the Python-Dev mailing list