Skip to content
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

bpo-39769: Fix compileall ddir for subpkgs. #18676

Merged
merged 5 commits into from
Feb 29, 2020

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Feb 27, 2020

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.

https://bugs.python.org/issue39769

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.
@gpshead
Copy link
Member Author

gpshead commented Feb 27, 2020

while i marked this as needing a backport... it'll never be automatic. This fix was easy to make as I could use the new features introduced by #16012 to implement it. I'm not sure it is worth it, nobody noticed for four releases. Easiest to just let 3.9 get this.

@gpshead gpshead self-assigned this Feb 27, 2020
@gpshead gpshead requested a review from Yhg1s February 27, 2020 08:51
@codecov
Copy link

codecov bot commented Feb 27, 2020

Codecov Report

Merging #18676 into master will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #18676     +/-   ##
=========================================
  Coverage   82.12%   82.13%             
=========================================
  Files        1956     1955      -1     
  Lines      589830   584531   -5299     
  Branches    44477    44481      +4     
=========================================
- Hits       484427   480096   -4331     
+ Misses      95752    94790    -962     
+ Partials     9651     9645      -6     
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.92% <0.00%> (-13.85%) ⬇️
Lib/test/test_smtpnet.py 78.57% <0.00%> (-7.15%) ⬇️
Lib/ftplib.py 63.85% <0.00%> (-6.06%) ⬇️
Lib/test/test_ftplib.py 87.11% <0.00%> (-4.72%) ⬇️
Tools/scripts/db2pickle.py 17.82% <0.00%> (-3.97%) ⬇️
Tools/scripts/pickle2db.py 16.98% <0.00%> (-3.78%) ⬇️
Lib/test/test_socket.py 71.94% <0.00%> (-3.77%) ⬇️
... and 328 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 02a4d57...4e3543f. Read the comment docs.

@brettcannon brettcannon self-requested a review February 27, 2020 20:43
Lib/compileall.py Show resolved Hide resolved
Lib/compileall.py Outdated Show resolved Hide resolved
Lib/test/test_compileall.py Outdated Show resolved Hide resolved
Lib/test/test_compileall.py Outdated Show resolved Hide resolved
@bedevere-bot
Copy link

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@gpshead
Copy link
Member Author

gpshead commented Feb 28, 2020

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@Yhg1s: please review the changes made to this pull request.

@gpshead gpshead merged commit 0267335 into python:master Feb 29, 2020
@miss-islington
Copy link
Contributor

Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @gpshead, I had trouble checking out the 3.8 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 02673352b5db6ca4d3dc804965facbedfe66425d 3.8

@gpshead gpshead deleted the compileall_ddir branch February 29, 2020 01:28
gpshead added a commit to gpshead/cpython that referenced this pull request 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 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 added a commit that referenced this pull request Mar 1, 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 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.
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 <[email protected]>
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 <[email protected]> [Google]
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x Fedora LTO + PGO 3.7 has failed when building commit 7c64726.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/541/builds/12) and take a look at the build logs.
  4. Check if the failure is related to this commit (7c64726) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/541/builds/12

Summary of the results of the build (if available):

Click to see traceback logs
remote: Enumerating objects: 11, done.        
remote: Counting objects:   9% (1/11)        
remote: Counting objects:  18% (2/11)        
remote: Counting objects:  27% (3/11)        
remote: Counting objects:  36% (4/11)        
remote: Counting objects:  45% (5/11)        
remote: Counting objects:  54% (6/11)        
remote: Counting objects:  63% (7/11)        
remote: Counting objects:  72% (8/11)        
remote: Counting objects:  81% (9/11)        
remote: Counting objects:  90% (10/11)        
remote: Counting objects: 100% (11/11)        
remote: Counting objects: 100% (11/11), done.        
remote: Total 13 (delta 11), reused 11 (delta 11), pack-reused 2        
From https://github.com/python/cpython
 * branch                  3.7        -> FETCH_HEAD
Reset branch '3.7'

find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make[2]: [Makefile:1722: clean] Error 1 (ignored)
In file included from /home/dje/cpython-buildarea/3.7.edelsohn-fedora-z.lto-pgo/build/Modules/expat/expat_config.h:8,
                 from /home/dje/cpython-buildarea/3.7.edelsohn-fedora-z.lto-pgo/build/Modules/expat/xmltok.c:49:
./pyconfig.h:1526: warning: "_POSIX_C_SOURCE" redefined
 1526 | #define _POSIX_C_SOURCE 200809L
      | 
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/string.h:26,
                 from /home/dje/cpython-buildarea/3.7.edelsohn-fedora-z.lto-pgo/build/Modules/expat/xmltok.c:34:
/usr/include/features.h:295: note: this is the location of the previous definition
  295 | # define _POSIX_C_SOURCE 199506L
      | 
Task was destroyed but it is pending!
task: <Task pending coro=<<async_generator_athrow without __name__>()>>
Task was destroyed but it is pending!
task: <Task pending coro=<<async_generator_athrow without __name__>()>>

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.

5 participants