-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-118761: Improve import time of subprocess
#129427
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for including the comments in the code as to why. as much as a dislike it from a style perspective, this is the right way to get faster import times in Python today.
* subprocess: lazy import signal and locale to improve module import time (cherry picked from commit 49f2465) Co-authored-by: Taneli Hukkinen <[email protected]>
GH-129447 is a backport of this pull request to the 3.13 branch. |
* subprocess: lazy import signal and locale to improve module import time (cherry picked from commit 49f2465) Co-authored-by: Taneli Hukkinen <[email protected]>
GH-129448 is a backport of this pull request to the 3.12 branch. |
…29448) gh-118761: Improve import time of `subprocess` (GH-129427) * subprocess: lazy import signal and locale to improve module import time (cherry picked from commit 49f2465) Co-authored-by: Taneli Hukkinen <[email protected]>
|
…29447) gh-118761: Improve import time of `subprocess` (GH-129427) * subprocess: lazy import signal and locale to improve module import time (cherry picked from commit 49f2465) Co-authored-by: Taneli Hukkinen <[email protected]>
|
The iOS test failure is weird - yes, it failed in a stress test... but it then passed on a re-run. Not sure why it's reported as a fail (and a fail without identifying the failing test...) It doesn't look like a problem though. |
* subprocess: lazy import signal and locale to improve module import time
…H-129427)" This reverts commit 49f2465. This caused bugs in the `__del__` finalizer: python#118761 (comment)
…130201) * Revert "gh-118761: Improve import time of `subprocess` (GH-129427)" This reverts commit 49f2465. Also known as f502c8f in 3.13 (PR #129447) Also known as f65aa0d in 3.12 (PR #129448) This caused bugs in the `__del__` finalizer: #118761 (comment) --------- Co-authored-by: Bénédikt Tran <[email protected]>
…H-129427)" (pythonGH-130201) * Revert "pythongh-118761: Improve import time of `subprocess` (pythonGH-129427)" This reverts commit 49f2465. Also known as f502c8f in 3.13 (PR pythonGH-129447) Also known as f65aa0d in 3.12 (PR pythonGH-129448) This caused bugs in the `__del__` finalizer: python#118761 (comment) --------- (cherry picked from commit ae30646) Co-authored-by: Gregory P. Smith <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
…H-129427)" (pythonGH-130201) * Revert "pythongh-118761: Improve import time of `subprocess` (pythonGH-129427)" This reverts commit 49f2465. Also known as f502c8f in 3.13 (PR pythonGH-129447) Also known as f65aa0d in 3.12 (PR pythonGH-129448) This caused bugs in the `__del__` finalizer: python#118761 (comment) --------- (cherry picked from commit ae30646) Co-authored-by: Gregory P. Smith <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
)" (GH-130201) (#130205) gh-118761: Revert "Improve import time of `subprocess` (GH-129427)" (GH-130201) * Revert "gh-118761: Improve import time of `subprocess` (GH-129427)" This reverts commit 49f2465. Also known as f502c8f in 3.13 (PR GH-129447) Also known as f65aa0d in 3.12 (PR GH-129448) This caused bugs in the `__del__` finalizer: #118761 (comment) --------- (cherry picked from commit ae30646) Co-authored-by: Gregory P. Smith <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
)" (GH-130201) (#130204) gh-118761: Revert "Improve import time of `subprocess` (GH-129427)" (GH-130201) * Revert "gh-118761: Improve import time of `subprocess` (GH-129427)" This reverts commit 49f2465. Also known as f502c8f in 3.13 (PR GH-129447) Also known as f65aa0d in 3.12 (PR GH-129448) This caused bugs in the `__del__` finalizer: #118761 (comment) --------- (cherry picked from commit ae30646) Co-authored-by: Gregory P. Smith <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
This makes
import subprocess
lazy importlocale
andsignal
. As a result, alsore
(imported bylocale
) andenum
(imported bysignal
) imports are skipped.Benchmark import time
main
branchPR branch
Benchmark
subprocess.run
callIn fact, this not only has an effect on import time, but simple
subprocess.run
calls, too:main
branchPR branch