[issue19216] stat cache for import bootstrap

Eric Snow report at bugs.python.org
Fri Oct 11 00:11:24 CEST 2013


Eric Snow added the comment:

With ModuleSpec (PEP 451), the finder creates the spec object (where it stores the loader).  At that point the finder is free to store any stat object you like in spec.loader_state.  The spec is made available to the loader during exec (if the loader supports it, which the importlib loaders will).  So there is no need to add anything to any loader __init__.

The only catch is the slim possibility that the stat object will be stale by the time it gets used.  I seem to remember a case where something like this happened (related to distros building their system Python or something).

----------
nosy: +eric.snow

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


More information about the Python-bugs-list mailing list