On Tue, Jun 12, 2012 at 9:38 AM, Alex Gaynor <alex.gaynor@gmail.com> wrote:
">

(original) (raw)



On Tue, Jun 12, 2012 at 1:04 PM, fwierzbicki@gmail.com <fwierzbicki@gmail.com> wrote:

On Tue, Jun 12, 2012 at 9:38 AM, Alex Gaynor <alex.gaynor@gmail.com> wrote:

> For PyPy: I'm not an expert in our import, but from looking at the source

>

> 1) imp.cache_from_source is unimplemented, it's an AttributeError.

Jython does not (yet) have a cache\_from\_source.

> 2) sys.dont\_write\_bytecode 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.dont\_write\_bytecode, but doesn't support
sys.dont\_read\_bytecode yet - do you happen to know when
dont\_read\_bytecode 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).