bpo-45949: Pure Python freeze module for cross builds (GH-29899)#29899
Conversation
|
Where would the frozen importlib files come from? Are you adding those back to git? (Otherwise I don't see how this helps.) |
Sorry, something went wrong.
|
Sorry, something went wrong.
|
Cross builds don't just need the same version -- they need to use the same commit, unless we're in beta or beyond. I'm not sure what's the point of ever using freeze_module.py for non-cross builds. Is it just so that freeze_module.py gets exercised regularly? |
Sorry, something went wrong.
Good point, I'll update the documentation.
Yes, you are correct. It is not necessary to use |
Sorry, something went wrong.
|
The main point of the PR is to get rid of This patch removes the dependency. Users will be able to cross build a 3.11 interpreter with a 3.11 host Python (once byte code and API has stabilized in beta). |
Sorry, something went wrong.
|
How about committing the importlib bootstrap related files to git and generate the rest with pure python version on both standard and cross builds provided the bytecode is same, this would simplify things a lot ? |
Sorry, something went wrong.
In the past we had the importlib bootstrap files in git. The approach has the downside that it increases the size of git history a lot. Really a lot a lot. The files are fairly large, about 350k in total. They also must be regenerated every time the source Python files are updated or any aspect of the byte code generator and optimizer is changed. Even a tiny change results in a large diff, often affecting all lines of the header files. |
Sorry, something went wrong.
Yes, it will increase the size of git history but does anyone clones the repo in full ?, for builds most would do a shallow clone.
For diff, these files can be marked as linguist-generated then github would suppress them in PRs |
Sorry, something went wrong.
I have a full clone and usually everybody else with a local checkout has a full clone as well. |
Sorry, something went wrong.
It opens a great possibility to introduce a vulnerability into the Python codebase. Huge (especially suppressed) diffs are hard to analyze so they allow alterations of a generated file that will go unnoticed. In addition, GitHub is just a part of a development conveyor. Before it there ara local non-Github tools (git diff/gitk, TortoiseGit, Sublime Merge, and so on) that do not support
Actually this is the very purpose of Git as a distributed version control system, to distribute full clones and work with them offline. |
Sorry, something went wrong.
If generated files were to be added to the repo then it would have been verified on CI that the generated files and files generated on CI are equal. |
Sorry, something went wrong.
You would also have to make sure that non of the validating tools rely on the generated files. |
Sorry, something went wrong.
If bots are/will be involved, then I agree and retract my note on vulnerability planting. In fact, I am aware that bootstrapping in a bare environment with no predecessor (so _bootstrap_python minimal interpreter is introduced) is a can of worms that force hardly bearable compromises. |
Sorry, something went wrong.
|
Indeed, maintainability of the diffs is still a question. Even with suppression, unanalysable black boxes carried along with actual proposed changed is not a good idea. |
Sorry, something went wrong.
7d9cda1 to
dce68d0
Compare
December 3, 2021 15:25
|
I have added more comments to explain the bootstrap process. Sorry for the squash merge + force push. I ran into merge conflicts and eventually gave up. Merge was less work. |
Sorry, something went wrong.
f7e07fd to
2a44284
Compare
December 3, 2021 18:36
454514c to
55e1527
Compare
December 9, 2021 14:26
ericsnowcurrently
left a comment
There was a problem hiding this comment.
Mostly LGTM.
I've left a few minor comments. The only matter of consequence is about make rule dependencies in the cross-compiling case, as well as running make regen-frozen as one of the steps for a cross-compiled build.
I'm approving the PR under the assumption that you'll resolve my concerns before merging. 🙂
Sorry, something went wrong.
|
and sorry for the delay in getting you a review! |
Sorry, something went wrong.
Use `_bootstrap_python` interpreter and pure Python implementation of `freeze_module` to generate frozen byte code files. Only importlib bootstrap files are generated with `Programs/_freeze_module`. This simplifies cross building, as the build system no longer needs a `_freeze_module` binary. A standard Python installation with same version is sufficient. Signed-off-by: Christian Heimes <christian@python.org>
55e1527 to
4fd065f
Compare
December 11, 2021 16:41
- Fix typo - Remove confusing comment - Improve dependency handling for freezing
4fd065f to
0d328a9
Compare
December 11, 2021 16:42
|
@ericsnowcurrently Are you satisfied with the current state of the patch? |
Sorry, something went wrong.
ericsnowcurrently
left a comment
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 Windows8.1 Non-Debug 3.x has failed when building commit eb483c4. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/all/#builders/405/builds/831 Summary of the results of the build (if available): == Tests result: ENV CHANGED == 400 tests OK. 10 slowest tests:
1 test altered the execution environment: 30 tests skipped: Total duration: 10 min 8 sec Click to see traceback logsTraceback (most recent call last):
File "D:\buildarea\3.x.ware-win81-release.nondebug\build\Lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
^^^^^^^^^^^^
File "D:\buildarea\3.x.ware-win81-release.nondebug\build\Lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\buildarea\3.x.ware-win81-release.nondebug\build\Lib\asyncio\base_events.py", line 745, in call_soon
self._check_closed()
^^^^^^^^^^^^^^^^^^^^
File "D:\buildarea\3.x.ware-win81-release.nondebug\build\Lib\asyncio\base_events.py", line 506, in _check_closed
raise RuntimeError('Event loop is closed')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Event loop is closed
k
|
Sorry, something went wrong.
Use
_bootstrap_pythoninterpreter and pure Python implementation offreeze_moduleto generate frozen byte code files. Only importlibbootstrap files are generated with
Programs/_freeze_module.This simplifies cross building, as the build system no longer needs a
_freeze_modulebinary. A standard Python installation with sameversion is sufficient.
Signed-off-by: Christian Heimes christian@python.org
https://bugs.python.org/issue45949