[Python-Dev] [compatibility-sig] making sure importlib.machinery.SourceLoader doesn't throw an exception if bytecode is not supported by a VM (original) (raw)

Brett Cannon brett at python.org
Tue Jun 12 16:52:18 CEST 2012


I would like to have importlib just work out of the box for all VMs in 3.3 instead of requiring a minor patch in order to not throw an exception when loading from source and there is no bytecode. The relevant code for this discussion can be seen at http://hg.python.org/cpython/file/c2910971eb86/Lib/importlib/_bootstrap.py#l691 .

First question is what are all the VMs doing for imp.cache_from_source()? Are you implementing it like CPython, or are you returning None? And if you implemented it, what does marshal.loads() do? Right now cache_from_source() is implemented in importlib itself, but we can either provide a flag to control what it does or in your setup code for import you can override the function with lambda _, __=None: None.

Second question, what do you set sys.dont_write_bytecode to?

The answers to those questions will dictate if there is anything to actually discuss. =) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20120612/3f1ab570/attachment.html>



More information about the Python-Dev mailing list