[Pythonmac-SIG] Is Python bytecode cross-platform?

Michael Hudson mwh at python.net
Mon Mar 8 08:01:53 EST 2004


Bob Ippolito <bob at redivi.com> writes:

> On Mar 6, 2004, at 1:12 AM, Mailing List wrote:
>
>> Should a pyc file created on my Panther Mac run on other platforms?
>> My initial observations are that it won't, is this correct or am I
>> just doing something wrong?
>
> pyc files are definitely specific to the version of Python that
> produced them, though I believe that the bytecodes don't change very
> often (at all?) between minor releases.

Bytecode from 2.Y.Z is compatible with bytecode from 2.Y.W.  This has
sometimes been painful to acheive, but it's a serious goal.

Bytecode from 2.Y is NOT compatible with bytecode 2.Z.  We don't try
to make it incompatible, but we always seem to find some reason to do
it :-)

> I don't believe that the platform is a factor.

It isn't.  marshal goes to some pain to be platform independent.

Cheers,
mwh

-- 
  ZAPHOD:  You know what I'm thinking?
    FORD:  No.
  ZAPHOD:  Neither do I.  Frightening isn't it?
                   -- The Hitch-Hikers Guide to the Galaxy, Episode 11



More information about the Pythonmac-SIG mailing list