gh-148615: Handle -- end-of-options separator in pdb argument parsing#148624
Open
Shrey-N wants to merge 3 commits intopython:mainfrom
Open
gh-148615: Handle -- end-of-options separator in pdb argument parsing#148624Shrey-N wants to merge 3 commits intopython:mainfrom
-- end-of-options separator in pdb argument parsing#148624Shrey-N wants to merge 3 commits intopython:mainfrom
Conversation
Member
|
Thanks for fixing this. We need some regression test on this. We need to test the specific case reported, and also some others. I wonder if For the code itself, let's move |
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.
The switch from
getopttoargparsein gh-125115,python -m pdbrejects the standard--end-of-options separator. Makes it impossible to pass arguments that share names with pdb flags (like-c) to the target script.The root cause is that pdb's argparse parser has no positional arguments defined, so
parse_known_args()does not consume--and returns it in the remainder list. The manual post processing logic inparse_args()then incorrectly treats it as an unrecognized flag since it starts with-.This adds a check for
--in theelif args[0].startswith('-'). When found, the separator is consumed and parsing continues to the script name. If no script follows, an error is raised. All other unrecognized flags continue to produce the existing error message.Closes gh-148615 :)