[Python-Dev] How to interpret get_code from PEP 302?

Phillip J. Eby pje at telecommunity.com
Tue Aug 21 21:03:20 CEST 2007


At 11:22 AM 8/21/2007 -0700, Brett Cannon wrote:
>This also means pkgutil is possibly non-compliant as it's get_code
>implementation does the above suggestion (tries for source to avoid
>timestamp check, and uses bytecode as backup).

That's not actually true, it just *looks* that way.  IIRC, mod_type 
will only be PY_SOURCE if there's no compiled version available.

There's a different bug, though, which is that if you call get_code() 
on an ImpLoader when the module hasn't been loaded, you could get 
out-of-date code, because it's currently relying on imp to do the 
timestamp check and recompile.



More information about the Python-Dev mailing list