Skip to content

Conversation

@duaneg
Copy link
Contributor

@duaneg duaneg commented Jun 9, 2025

The main_path parameter was renamed init_main_from_name, update the forkserver code accordingly.

The `main_path` parameter was renamed `init_main_from_name`, update the
forkserver code accordingly.
@duaneg duaneg marked this pull request as ready for review June 10, 2025 09:45
@duaneg duaneg requested a review from gpshead as a code owner June 10, 2025 09:45
@duaneg
Copy link
Contributor Author

duaneg commented Jun 10, 2025

If/when #135335 is fixed we can remove the explicit flush from the test script. Likewise, if/when this is fixed the regression test in the PR for that issue can be simplified to just use a script (preloading __main__) instead of having to create and import a module.

@emaxx-google
Copy link

@gpshead could we proceed with this PR in favor of my #138048 (which is essentially identical, but lacks test coverage)? This would fix the performance issue reported in #137996.

@duaneg
Copy link
Contributor Author

duaneg commented Sep 4, 2025

@gpshead could we proceed with this PR in favor of my #138048 (which is essentially identical, but lacks test coverage)?

FTR, I'd be perfectly fine with you copying the regression test from this into your PR, too. Whatever is easiest!

@gpshead gpshead self-assigned this Sep 7, 2025
@gpshead gpshead added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes type-bug An unexpected behavior, bug, or error labels Sep 7, 2025
@gpshead gpshead enabled auto-merge (squash) September 7, 2025 07:27
@gpshead gpshead merged commit 0912b3a into python:main Sep 7, 2025
55 checks passed
@miss-islington-app
Copy link

Thanks @duaneg for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

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 <[email protected]>
Co-authored-by: Gregory P. Smith <[email protected]>
@miss-islington-app
Copy link

Sorry, @duaneg and @gpshead, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 0912b3a6dbd226bea79eb8d70d5a06230804d4cb 3.13

@bedevere-app
Copy link

bedevere-app bot commented Sep 7, 2025

GH-138607 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Sep 7, 2025
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 <[email protected]>
Co-authored-by: Gregory P. Smith <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Sep 7, 2025

GH-138609 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Sep 7, 2025
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 <[email protected]>
@emaxx-google
Copy link

Thanks a lot, @duaneg and @gpshead!

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 <[email protected]>
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 <[email protected]>
Co-authored-by: Gregory P. Smith <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Gregory P. Smith <[email protected]>
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.

3 participants