]> granicus.if.org Git - python/commit
closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)
authorBenjamin Peterson <benjamin@python.org>
Sat, 9 Dec 2017 18:26:52 +0000 (10:26 -0800)
committerGitHub <noreply@github.com>
Sat, 9 Dec 2017 18:26:52 +0000 (10:26 -0800)
commit42aa93b8ff2f7879282b06efc73a31ec7785e602
tree92ee301e1f487a7f5aa8ec78a36ebc50d21d6ec9
parent28d8d14013ade0657fed4673f5fa3c08eb2b1944
closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)

Python now supports checking bytecode cache up-to-dateness with a hash of the
source contents rather than volatile source metadata. See the PEP for details.

While a fairly straightforward idea, quite a lot of code had to be modified due
to the pervasiveness of pyc implementation details in the codebase. Changes in
this commit include:

- The core changes to importlib to understand how to read, validate, and
  regenerate hash-based pycs.

- Support for generating hash-based pycs in py_compile and compileall.

- Modifications to our siphash implementation to support passing a custom
  key. We then expose it to importlib through _imp.

- Updates to all places in the interpreter, standard library, and tests that
  manually generate or parse pyc files to grok the new format.

- Support in the interpreter command line code for long options like
  --check-hash-based-pycs.

- Tests and documentation for all of the above.
33 files changed:
Doc/glossary.rst
Doc/library/compileall.rst
Doc/library/importlib.rst
Doc/library/py_compile.rst
Doc/reference/import.rst
Doc/using/cmdline.rst
Doc/whatsnew/3.7.rst
Include/internal/hash.h [new file with mode: 0644]
Include/internal/import.h [new file with mode: 0644]
Include/pygetopt.h
Lib/compileall.py
Lib/importlib/_bootstrap_external.py
Lib/importlib/util.py
Lib/modulefinder.py
Lib/pkgutil.py
Lib/py_compile.py
Lib/test/test_compileall.py
Lib/test/test_imp.py
Lib/test/test_import/__init__.py
Lib/test/test_importlib/source/test_file_loader.py
Lib/test/test_importlib/test_abc.py
Lib/test/test_py_compile.py
Lib/test/test_zipimport.py
Misc/NEWS.d/next/Core and Builtins/2017-11-26-14-38-44.bpo-31650.JWf_Im.rst [new file with mode: 0644]
Misc/python.man
Modules/main.c
Modules/zipimport.c
Python/clinic/import.c.h
Python/getopt.c
Python/import.c
Python/importlib_external.h
Python/pyhash.c
Python/pythonrun.c