Repository navigation
gh-162531: clean up stale pyo references in the build and zipimport - #162532
Conversation
hugovk
left a comment
There was a problem hiding this comment.
Thanks, here's some more we can clean up:
Line 2890 in 32b51e3
Line 20 in 32b51e3
Line 207 in 32b51e3
Line 18 in 32b51e3
cpython/Mac/BuildScript/build-installer.py
Line 1556 in 32b51e3
Line 12 in 32b51e3
cpython/Tools/buildbot/clean.bat
Lines 12 to 13 in 32b51e3
| # non-package .pyc, and .py entries. The .pyc entries | ||
| # are swapped by initzipimport() if we run in optimized mode. Also, | ||
| # '/' is replaced by path_sep there. | ||
| # Search for packages before modules, and for bytecode before source. |
There was a problem hiding this comment.
Let's keep these comment diffs to a minimum:
| # Search for packages before modules, and for bytecode before source. | |
| # _zip_searchorder defines how we search for a module in the Zip | |
| # archive: we first search for a package __init__, then for | |
| # non-package .pyc, and .py entries. |
There was a problem hiding this comment.
thanks, updated the cleanup paths and kept the zipimport comment changes minimal.
| if _importing_zlib: | ||
| # Someone has a zlib.py[co] in their Zip file | ||
| # let's avoid a stack overflow. | ||
| # Importing zlib from the archive would recurse. |
There was a problem hiding this comment.
| # Importing zlib from the archive would recurse. | |
| # Someone has a zlib.pyc in their Zip file | |
| # let's avoid a stack overflow. |
| if _importing_zstd: | ||
| # Someone has a _zstd.py[co] in their Zip file | ||
| # let's avoid a stack overflow. | ||
| # Importing _zstd from the archive would recurse. |
There was a problem hiding this comment.
| # Importing _zstd from the archive would recurse. | |
| # Someone has a _zstd.pyc in their Zip file | |
| # let's avoid a stack overflow. |
| # Given the contents of a .py[co] file, unmarshal the data | ||
| # and return the code object. Raises ImportError it the magic word doesn't | ||
| # match, or if the recorded .py[co] metadata does not match the source. | ||
| # Unmarshal the code object from a .pyc file. |
There was a problem hiding this comment.
| # Unmarshal the code object from a .pyc file. | |
| # Given the contents of a .pyc file, unmarshal the data | |
| # and return the code object. Raises ImportError it the magic word doesn't | |
| # match, or if the recorded .pyc metadata does not match the source. |
| def _get_pyc_source(self, path): | ||
| # strip 'c' or 'o' from *.py[co] | ||
| assert path[-1:] in ('c', 'o') | ||
| assert path.endswith('.pyc') |
There was a problem hiding this comment.
| assert path.endswith('.pyc') | |
| # # strip 'c' from *.pyc | |
| assert path.endswith('.pyc') |
|
Thanks @tonghuaroot for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Thanks @tonghuaroot for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
Sorry, @tonghuaroot and @hugovk, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
|
GH-162862 is a backport of this pull request to the 3.15 branch. |
|
@tonghuaroot Would you like to do the 3.14 backport? Thank you. |
|
GH-162866 is a backport of this pull request to the 3.14 branch. |
clean up legacy .pyo references in build and install scripts, and keep the zipimport changes to comments and assertions.
https://discuss.python.org/t/updating-old-patch-to-run-on-3-16-getting-weird-errors/110249/9