Skip to content

[3.8] bpo-39769: Fix compileall ddir for subpkgs. (GH-18676) #18718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2020

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Feb 29, 2020

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 #18676 's 0267335,
the implementation is different due to intervening code changes. But still
quiet simple. 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.

https://bugs.python.org/issue39769

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 0267335, the
implementation is different due to intervening code changes.  But still
quiet simple.  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.
@gpshead gpshead added type-bug An unexpected behavior, bug, or error needs backport to 3.7 labels Feb 29, 2020
@gpshead gpshead changed the title bpo-39769: Fix compileall ddir for subpkgs. (GH-18676) [3.8] bpo-39769: Fix compileall ddir for subpkgs. Feb 29, 2020
@gpshead gpshead changed the title [3.8] bpo-39769: Fix compileall ddir for subpkgs. [3.8] bpo-39769: Fix compileall ddir for subpkgs. (GH-18676) Feb 29, 2020
@codecov
Copy link

codecov bot commented Feb 29, 2020

Codecov Report

Merging #18718 into 3.8 will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##              3.8   #18718      +/-   ##
==========================================
+ Coverage   82.08%   82.10%   +0.01%     
==========================================
  Files        1919     1918       -1     
  Lines      582229   576908    -5321     
  Branches    43736    43739       +3     
==========================================
- Hits       477944   473682    -4262     
+ Misses      94716    93655    -1061     
- Partials     9569     9571       +2     
Impacted Files Coverage Δ
Lib/distutils/tests/test_bdist_rpm.py 30.00% <0.00%> (-65.00%) ⬇️
Lib/distutils/command/bdist_rpm.py 7.63% <0.00%> (-56.88%) ⬇️
Modules/_decimal/libmpdec/umodarith.h 80.76% <0.00%> (-19.24%) ⬇️
Lib/test/test_urllib2net.py 76.68% <0.00%> (-13.99%) ⬇️
Lib/test/test_smtpnet.py 78.57% <0.00%> (-7.15%) ⬇️
Lib/ftplib.py 63.72% <0.00%> (-6.08%) ⬇️
Lib/test/test_ftplib.py 87.08% <0.00%> (-4.74%) ⬇️
Tools/scripts/db2pickle.py 17.82% <0.00%> (-3.97%) ⬇️
Lib/test/test_socket.py 72.14% <0.00%> (-3.89%) ⬇️
Tools/scripts/pickle2db.py 16.98% <0.00%> (-3.78%) ⬇️
... and 335 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45c4112...a929754. Read the comment docs.

@gpshead gpshead merged commit ce720d3 into python:3.8 Mar 1, 2020
@miss-islington
Copy link
Contributor

Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington
Copy link
Contributor

Sorry, @gpshead, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker ce720d3e0674d6ac6f1b950c20a89be4cfde7853 3.7

@gpshead gpshead deleted the compall_ddir_3.8 branch March 1, 2020 18:43
gpshead added a commit to gpshead/cpython that referenced this pull request Mar 1, 2020
…ythonGH-18718)

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 0267335, 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 ce720d3)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@bedevere-bot
Copy link

GH-18725 is a backport of this pull request to the 3.7 branch.

gpshead added a commit that referenced this pull request Mar 1, 2020
… (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 0267335, 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 ce720d3)

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants