python bytecode compatibility

前端 未结 1 2014
慢半拍i
慢半拍i 2021-01-15 16:36

To what extent is python bytecode compatible between releases. I\'m not talking about python2.x to python3.x but say... Python33 to python34?

I am not after it for \

相关标签:
1条回答
  • 2021-01-15 17:21

    Python makes no guarantee about bytecode compatibility between versions. Don't rely on it.

    In fact, a pyc file starts with a magic number that changes every time the marshalling code does, and python checks this number for compatibility. Since this code changes pretty much every version, so does the magic number. See Ned Batchelder's blog entry for details.

    There are better ways of ensuring your files haven't been tampered with: checksums, for example.

    0 讨论(0)
提交回复
热议问题