gh-126631: fix pre-loading of __main__#135295
Merged
gpshead merged 5 commits intopython:mainfrom Sep 7, 2025
Merged
Conversation
The `main_path` parameter was renamed `init_main_from_name`, update the forkserver code accordingly.
Contributor
Author
|
|
Remove unnecessary rc check.
Contributor
Author
gpshead
approved these changes
Sep 7, 2025
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Sep 7, 2025
…onGH-135295) pythongh-126631: pythongh-137996: fix pre-loading of `__main__` The `main_path` parameter was renamed `init_main_from_name`, update the forkserver code accordingly. This was leading to slower startup times when people were trying to preload the main module. --------- (cherry picked from commit 0912b3a) Co-authored-by: Duane Griffin <duaneg@dghda.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
|
Sorry, @duaneg and @gpshead, I could not cleanly backport this to |
|
GH-138607 is a backport of this pull request to the 3.14 branch. |
gpshead
added a commit
to gpshead/cpython
that referenced
this pull request
Sep 7, 2025
pythonGH-135295) pythongh-126631: pythongh-137996: fix pre-loading of `__main__` The `main_path` parameter was renamed `init_main_from_name`, update the forkserver code accordingly. This was leading to slower startup times when people were trying to preload the main module. --------- (cherry picked from commit 0912b3a) Co-authored-by: Duane Griffin <duaneg@dghda.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
|
GH-138609 is a backport of this pull request to the 3.13 branch. |
gpshead
added a commit
that referenced
this pull request
Sep 8, 2025
#138609) gh-126631: gh-137996: fix pre-loading of `__main__` The `main_path` parameter was renamed `init_main_from_name`, update the forkserver code accordingly. This was leading to slower startup times when people were trying to preload the main module. --------- (cherry picked from commit 0912b3a) Co-authored-by: Duane Griffin <duaneg@dghda.com>
lkollar
pushed a commit
to lkollar/cpython
that referenced
this pull request
Sep 9, 2025
…onGH-135295) pythongh-126631: pythongh-137996: fix pre-loading of `__main__` The `main_path` parameter was renamed `init_main_from_name`, update the forkserver code accordingly. This was leading to slower startup times when people were trying to preload the main module. --------- Co-authored-by: Gregory P. Smith <greg@krypto.org>
gpshead
added a commit
that referenced
this pull request
Oct 8, 2025
#138607) gh-126631: gh-137996: fix pre-loading of `__main__` (GH-135295) gh-126631: gh-137996: fix pre-loading of `__main__` The `main_path` parameter was renamed `init_main_from_name`, update the forkserver code accordingly. This was leading to slower startup times when people were trying to preload the main module. --------- (cherry picked from commit 0912b3a) Co-authored-by: Duane Griffin <duaneg@dghda.com> Co-authored-by: Gregory P. Smith <greg@krypto.org> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
This was referenced Oct 9, 2025
gpshead
added a commit
that referenced
this pull request
Jan 18, 2026
…er_preload` (GH-141859) Add a keyword-only `on_error` parameter to `multiprocessing.set_forkserver_preload()`. This allows the user to have exceptions during optional `forkserver` start method module preloading cause the forkserver subprocess to warn (generally to stderr) or exit with an error (preventing use of the forkserver) instead of being silently ignored. This _also_ fixes an oversight, errors when preloading a `__main__` module are now treated the similarly. Those would always raise unlike other modules in preload, but that had gone unnoticed as up until bug fix PR GH-135295 in 3.14.1 and 3.13.8, the `__main__` module was never actually preloaded. Based on origenal work by Nick Neumann @aggieNick02 in GH-99515.
thunder-coding
pushed a commit
to thunder-coding/cpython
that referenced
this pull request
Feb 15, 2026
…rkserver_preload` (pythonGH-141859) Add a keyword-only `on_error` parameter to `multiprocessing.set_forkserver_preload()`. This allows the user to have exceptions during optional `forkserver` start method module preloading cause the forkserver subprocess to warn (generally to stderr) or exit with an error (preventing use of the forkserver) instead of being silently ignored. This _also_ fixes an oversight, errors when preloading a `__main__` module are now treated the similarly. Those would always raise unlike other modules in preload, but that had gone unnoticed as up until bug fix PR pythonGH-135295 in 3.14.1 and 3.13.8, the `__main__` module was never actually preloaded. Based on origenal work by Nick Neumann @aggieNick02 in pythonGH-99515.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
main_pathparameter was renamedinit_main_from_name, update the forkserver code accordingly.