开发者

Are pyc files independent of the interpreter architecture?

开发者 https://www.devze.com 2023-01-18 05:47 出处:网络
From the tests I\'ve done, with the same ver开发者_运维百科sion 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.

From the tests I've done, with the same ver开发者_运维百科sion 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消