]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.7] bpo-39769: Fix compileall ddir for subpkgs. (GH-18676) (GH-18718) (GH-18725)
authorGregory P. Smith <greg@krypto.org>
Sun, 1 Mar 2020 19:06:54 +0000 (11:06 -0800)
committerGitHub <noreply@github.com>
Sun, 1 Mar 2020 19:06:54 +0000 (11:06 -0800)
commit7c64726ced3d6b5d04537386d6a9ca6d179c3be4
tree38c248ee501fb5b96f4590d4f36cc451e1a4f03f
parentc4ca1f8f24118dc5c29e16118fb35a13963af290
[3.7] bpo-39769: Fix compileall ddir for subpkgs. (GH-18676) (GH-18718) (GH-18725)

Fix compileall.compile_dir() ddir= behavior on sub-packages.

Fixes compileall.compile_dir's ddir parameter and compileall command
line flag `-d` to no longer write the wrong pathname to the generated
pyc file for submodules beneath the root of the directory tree being
compiled.  This fixes a regression introduced with Python 3.5.

Tests backported from GH 02673352b5db6ca4d3dc804965facbedfe66425d, the
implementation is different due to intervening code changes.  But still
quiet simple.

Why was the bug ever introduced?  The refactoring to add parallel
execution kept the ddir -> dfile computations but discarded the results
instead of sending them to compile_file().  This fixes that.  Lack of tests
meant this went unnoticed..
(cherry picked from commit ce720d3e0674d6ac6f1b950c20a89be4cfde7853)

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
Lib/compileall.py
Lib/test/test_compileall.py
Lib/test/test_importlib/util.py
Misc/NEWS.d/next/Library/2020-02-29-13-20-33.bpo-39769.hJmxu4.rst [new file with mode: 0644]