Skip to content

gh-93016: Fix parsing of arguments in the IDLE "Run... Customized" dialog - #157635

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-93016-run-custom-args
Open

serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-93016-run-custom-args

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

CustomRun.cli_args_ok() used shlex.split() with POSIX rules on every platform, so on Windows backslashes were treated as escape characters (c:\Users became c:Users) and single quotes as quotes, unlike python.exe, whose sys.argv follows the C runtime rules. And the previous arguments were passed as a list to the entry StringVar, which displayed them as a Tcl list ({c:users}).

On Windows, the command line is now split with the same rules as the C runtime uses (backslashes are literal unless they precede a double quote; \" is a literal quote; "" inside a quoted part is a literal quote). The new util._split_windows() was checked against the actual sys.argv of python.exe on Windows for a set of tricky inputs, and it round-trips subprocess.list2cmdline(), which is now used to display the previous arguments (shlex.join() on other platforms).

🤖 Generated with Claude Code

…ed" dialog

On Windows, split the command line as the Python executable does instead
of using the POSIX rules, so that backslashes are not escape characters.
Display previous arguments quoted and joined, not as a Tcl list.
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant