Are pyc files independent of interpreter architecture?

From the tests I did, with the same python version (same magic number), a 64-bit interpreter can load pyc files executed with a 32-bit version of python. And mutually, I suppose.

But is it absolutely safe? Could this lead to unexpected behavior?

+3
source share
1 answer

pyc files are stored in python marshal format.

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

it seems that the only problem is with encoded integers, which automatically drop to 32-bit integers when you read pyc on a 32-bit machine.

pyc 64- / , pyc 64-, 32- .

+2

Source: https://habr.com/ru/post/1767163/


All Articles