[Python-Dev] Intention to accept PEP 552 soon (deterministic pyc files)

Serhiy Storchaka storchaka at gmail.com
Tue Oct 3 12:53:29 EDT 2017

26.09.17 23:47, Guido van Rossum пише:
> I've read the current version of PEP 552 over and I think everything 
> looks good for acceptance. I believe there are no outstanding objections 
> (or they have been adequately addressed in responses).
> Therefore I intend to accept PEP 552 this Friday, unless grave 
> objections are raised on this mailing list (python-dev).
> Congratulations Benjamin. Gotta love those tristate options!

While PEP 552 is accepted, I would want to see some changes.

1. Increase the size of the constant part of the signature to at least 
32 bits. Currently only the third and forth bytes are constant, and they 
are '\r\n', that is often occurred in text files. The first two bytes 
can be different in every Python version. This make hard detecting pyc 
files by utilities like file (1).

2. Split the "version" of pyc files by "major" and "minor" parts. Every 
major version is incompatible with other major versions, the interpreter 
accepts only one particular major version. It can't be changed in a 
bugfix release. But all minor versions inside the same major version are 
forward and backward compatible. The interpreter should be able to 
execute pyc file with arbitrary minor version, but it can use minor 
version of pyc file to handle errors in older versions. Minor version 
can be changed in a bugfix release. I hope this can help us with issues 
like https://bugs.python.org/issue29537. Currently 3.5 supports two 
magic numbers.

If we change the pyc format, it would be easy to make the above changes.

More information about the Python-Dev mailing list