[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 19:13:50 CEST 2012
- Previous message: [Python-Dev] [compatibility-sig] making sure importlib.machinery.SourceLoader doesn't throw an exception if bytecode is not supported by a VM
- Next message: [Python-Dev] [compatibility-sig] making sure importlib.machinery.SourceLoader doesn't throw an exception if bytecode is not supported by a VM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Jun 12, 2012 at 1:04 PM, fwierzbicki at gmail.com < fwierzbicki at gmail.com> wrote:
On Tue, Jun 12, 2012 at 9:38 AM, Alex Gaynor <alex.gaynor at gmail.com> wrote: > For PyPy: I'm not an expert in our import, but from looking at the source > > 1) imp.cachefromsource is unimplemented, it's an AttributeError. Jython does not (yet) have a cachefromsource.
> 2) sys.dontwritebytecode is always false, we don't respect that flag (we really > should IMO, but it's not a high priority for me, or anyone else apparently) Jython does support sys.dontwritebytecode, but doesn't support sys.dontreadbytecode yet - do you happen to know when dontreadbytecode was added?
It was never added since it doesn't currently exist; I said add sys.dont_read_bytecode, not use. =)
Would the flag actually be beneficial? Have you had issues where people assumed that Jython should be able to read bytecode since they just didn't worry about a VM that can't read bytecode? I mean I'm open to suggestions as ways to control bytecode reading to fail gracefully in case someone runs Jython (or IronPython) in a directory where PyPy or CPython was run previously and thus the bytecode exists from them. That's why I asked what marshal.loads() does; if it returns None or raises some exception that can be distinguished from a failure of badly formatted marshal data then I could rely on that as another option.
It should be pretty straightforward, and so I'll probably add it to our 2.7.
I would assume it would just be a flag for you. Importlib and other stdlib code would be where all the work would be to start obeying the flag (if it is added). -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20120612/96b0ed60/attachment.html>
- Previous message: [Python-Dev] [compatibility-sig] making sure importlib.machinery.SourceLoader doesn't throw an exception if bytecode is not supported by a VM
- Next message: [Python-Dev] [compatibility-sig] making sure importlib.machinery.SourceLoader doesn't throw an exception if bytecode is not supported by a VM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]