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

Guido van Rossum gvanrossum at gmail.com
Wed Oct 4 11:08:50 EDT 2017


On Oct 3, 2017 9:55 AM, "Serhiy Storchaka" <storchaka at gmail.com> wrote:

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.


IIUC the PEP doesn't commit to any particular magic word format, so this
can be negotiated separately, on the tracker (unless there's a PEP
specifying the internal structure of the magic word?).

--Guido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171004/667afdfd/attachment.html>


More information about the Python-Dev mailing list