Skip to content
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

gh-121018: Fix more cases of exiting in argparse when exit_on_error=False #121056

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jun 26, 2024

  • parse_intermixed_args() now raises ArgumentError instead of calling error() if exit_on_error is false.
  • Internal code now always raises ArgumentError instead of calling error(). It is then caught at higher level and error() is called if exit_on_error is true.

…rror=False

* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at higher level and error() is called if
  exit_on_error is true.
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the argparse-exit_on_error branch June 28, 2024 14:22
@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 81a654a3425eaa05a51342509089533c1f623f1b 3.13

@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 81a654a3425eaa05a51342509089533c1f623f1b 3.12

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Jun 28, 2024
…it_on_error=False (pythonGH-121056)

* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at the higher level and error() is called if
  exit_on_error is true.
(cherry picked from commit 81a654a)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jun 28, 2024

GH-121128 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jun 28, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Jun 28, 2024
…it_on_error=False (pythonGH-121056)

* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at the higher level and error() is called if
  exit_on_error is true.
(cherry picked from commit 81a654a)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jun 28, 2024

GH-121129 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Jun 28, 2024
serhiy-storchaka added a commit that referenced this pull request Jun 28, 2024
…error=False (GH-121056) (GH-121129)

* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at the higher level and error() is called if
  exit_on_error is true.
(cherry picked from commit 81a654a)
serhiy-storchaka added a commit that referenced this pull request Jun 28, 2024
…error=False (GH-121056) (GH-121128)

* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at the higher level and error() is called if
  exit_on_error is true.
(cherry picked from commit 81a654a)
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
…rror=False (pythonGH-121056)

* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at the higher level and error() is called if
  exit_on_error is true.
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
…rror=False (pythonGH-121056)

* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at the higher level and error() is called if
  exit_on_error is true.
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
…rror=False (pythonGH-121056)

* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at the higher level and error() is called if
  exit_on_error is true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant