reorder fields a bit

This commit is contained in:
Benjamin Peterson 2017-09-07 12:30:49 -07:00
parent 70b6d5aac9
commit e6060a3355
1 changed files with 7 additions and 6 deletions

View File

@ -60,12 +60,13 @@ version. One magic number will correspond to the current pyc format and the
other to "hash-based" pycs introduced by this PEP. other to "hash-based" pycs introduced by this PEP.
In hash-based pycs, the second field in the pyc header (currently the In hash-based pycs, the second field in the pyc header (currently the
"timestamp" field) will contain the SipHash_ (with a hardcoded key) of the "timestamp" field) will become a bitset of flags. We define the lowest flag in
contents of the source file. Another a fast hash like MD5 or BLAKE2_ would also this bitset called ``check_source``. Following the bitset is a 64-bit hash of
work. We choose SipHash because Python already has a builtin implementation of the source file. We will use a SipHash_ (with a hardcoded key) of the contents
it from :pep:`456`. The third field in the pyc header (currently the "source of the source file. Another a fast hash like MD5 or BLAKE2_ would also work. We
size" field) will become a bitset of flags. We define the lowest flag in this choose SipHash because Python already has a builtin implementation of it from
bitset called ``check_source`` :pep:`456`, although an interface that allows picking the SipHash key must be
exposed to Python.
When Python encounters a hash-based pyc, its behavior depends on the setting of When Python encounters a hash-based pyc, its behavior depends on the setting of
the ``check_source`` flag. If the ``check_source`` flag is set, Python will the ``check_source`` flag. If the ``check_source`` flag is set, Python will