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

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


On Tue, Jun 12, 2012 at 10:52 AM, Brett Cannon <brett at python.org> wrote:

> 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``.
>

I should mention another option is to add sys.dont_read_bytecode (I think I
have discussed this with Frank at some point).

-Brett


>
> 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/2c92b2d6/attachment.html>


More information about the Python-Dev mailing list