gh-93016: Fix parsing of arguments in the IDLE "Run... Customized" dialog - #157635
Open
serhiy-storchaka wants to merge 1 commit into
Open
serhiy-storchaka wants to merge 1 commit into
serhiy-storchaka wants to merge 1 commit into
Conversation
…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.
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.
CustomRun.cli_args_ok()usedshlex.split()with POSIX rules on every platform, so on Windows backslashes were treated as escape characters (c:\Usersbecamec:Users) and single quotes as quotes, unlikepython.exe, whosesys.argvfollows the C runtime rules. And the previous arguments were passed as a list to the entryStringVar, 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 newutil._split_windows()was checked against the actualsys.argvofpython.exeon Windows for a set of tricky inputs, and it round-tripssubprocess.list2cmdline(), which is now used to display the previous arguments (shlex.join()on other platforms).🤖 Generated with Claude Code