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-45020: Identify which frozen modules are actually aliases. #28655

Merged

Conversation

@ericsnowcurrently
Copy link
Member

@ericsnowcurrently ericsnowcurrently commented Sep 30, 2021

In the list of generated frozen modules at the top of Tools/scripts/freeze_modules.py, you will find that some of the modules have a different name than the module (or .py file) that is actually frozen. Let's call each case an "alias". Aliases do not come into play until we get to the (generated) list of modules in Python/frozen.c. (The tool for freezing modules, Programs/_freeze_module, is only concerned with the source file, not the module it will be used for.)

Knowledge of which frozen modules are aliases (and the identity of the original module) normally isn't important. However, this information is valuable when we go to set __file__ on frozen stdlib modules. This change updates Tools/scripts/freeze_modules.py to map aliases to the original module name (or None if not a stdlib module) in Python/frozen.c. We also add a helper function in Python/import.c to look up a frozen module's alias and add the result of that function to the frozen info returned from find_frozen().

https://bugs.python.org/issue45020

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Oct 1, 2021

🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 38b3893 🤖

If you want to schedule another build, you need to add the "🔨 test-with-buildbots" label again.

@ericsnowcurrently ericsnowcurrently force-pushed the frozen-modules-aliases branch from 38b3893 to 071ab26 Oct 1, 2021
@ericsnowcurrently ericsnowcurrently changed the title bpo-21736: Identify which frozen modules are actually aliases. bpo-45020: Identify which frozen modules are actually aliases. Oct 1, 2021
@ericsnowcurrently ericsnowcurrently force-pushed the frozen-modules-aliases branch 3 times, most recently from 48ee937 to ccadbde Oct 2, 2021
@ericsnowcurrently ericsnowcurrently force-pushed the frozen-modules-aliases branch from ccadbde to 1e40678 Oct 5, 2021
@ericsnowcurrently ericsnowcurrently marked this pull request as ready for review Oct 5, 2021
@ericsnowcurrently ericsnowcurrently force-pushed the frozen-modules-aliases branch from 1e40678 to 7d23290 Oct 5, 2021
@ericsnowcurrently ericsnowcurrently removed the request for review from brettcannon Oct 5, 2021
@ericsnowcurrently ericsnowcurrently merged commit 08285d5 into python:main Oct 5, 2021
12 checks passed
@ericsnowcurrently ericsnowcurrently deleted the frozen-modules-aliases branch Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants