Python bytecode compatibility between interpreter versions

Roger Binns rogerb at rogerbinns.com
Mon Mar 22 00:17:54 CET 2004


Jon Perez wrote:
> Anyway, we can at least count on the fact that a .pyc compiled
> by a particular Python version (say, Python 2.1.1) on one platform
> (say, Mac), will run on another platform (say, Solaris) as long
> as the interpreter has the same minor version (say, Python 2.1.0).
>
> uh... right?

Nope.  They are an implementation specific thing.  The interpretter
puts version and other information in them, and regenerates them
on the fly.  There is nothing wrong with an interpretter deciding
to regenerate them every single day in a different format, or
based on the moon phase, or your login id or anything else.

Roger





More information about the Python-list mailing list