views:

40

answers:

1

From the tests I've done, with the same version of python (same magic number), a 64 bit interpreter can load pyc files made with a 32 bit version of python. And reciprocally I assume.

But is it totally safe? Can this lead to unexpected behavior?

+1  A: 

pyc files are stored in the python marshal format.

http://daeken.com/python-marshal-format

it seems that the only issue is with encoded integers which are automatically downgraded to 32 bit integers when you read the pyc on a 32 bit machine.

However the pyc format doesn't include 64bit addresses/offset inside it so the same pyc should run on both 64bit and 32bit interpreters.

ithkuil