开发者

Are pyc files independent of the interpreter architecture?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜