https://github.com/python/cpython/commit/6828ce01c9940590790a2ae1c3b7a3ac6f7f4907 commit: 6828ce01c9940590790a2ae1c3b7a3ac6f7f4907 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: terryjreedy <[email protected]> date: 2026-10-09T13:40:14-04:00 summary:
[3.15] gh-68453: Fix IDLE -s together with -c, -r or - (GH-157592) (#157640) gh-68453: Fix IDLE -s together with -c, -r or - (GH-157592) The startup file runs in the subprocess asynchronously, so the command or script was queued while it was still executing: an "Already executing" dialog was shown, sys.argv was not set, and the subprocess was restarted, discarding the startup file. Wait for the startup file to finish first. (cherry picked from commit 9cc3547536787ab8375c711ce56601c6b51f0461) Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> files: A Misc/NEWS.d/next/IDLE/2026-09-15-21-20-04.gh-issue-68453.hlxbog.rst M Lib/idlelib/pyshell.py diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index b263c7511d5341..c83edbb02d1795 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -1687,6 +1687,10 @@ def main(): if filename and os.path.isfile(filename): shell.interp.execfile(filename) if cmd or script: + # Let the startup file finish first: the command or script + # is to run after it, in its namespace (gh-68453). + while shell.executing: + root.update() shell.interp.runcommand("""if 1: import sys as _sys _sys.argv = {!r} diff --git a/Misc/NEWS.d/next/IDLE/2026-09-15-21-20-04.gh-issue-68453.hlxbog.rst b/Misc/NEWS.d/next/IDLE/2026-09-15-21-20-04.gh-issue-68453.hlxbog.rst new file mode 100644 index 00000000000000..4d8cfc1dbc6574 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2026-09-15-21-20-04.gh-issue-68453.hlxbog.rst @@ -0,0 +1,3 @@ +Fix running IDLE with the -s option together with -c, -r or -: the command +or script now runs after the startup file, without an error dialog and +without restarting the shell. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
