mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
[3.12] GH-79714: Add mention of stderr for clarity to ArgumentParser.exit() (GH-123932) (GH-124356)
(cherry picked from commit 5f5c0b9c23
)
This commit is contained in:
parent
dd2066f274
commit
b3709562ad
1 changed files with 4 additions and 4 deletions
|
@ -2190,8 +2190,8 @@ Exiting methods
|
||||||
.. method:: ArgumentParser.exit(status=0, message=None)
|
.. method:: ArgumentParser.exit(status=0, message=None)
|
||||||
|
|
||||||
This method terminates the program, exiting with the specified *status*
|
This method terminates the program, exiting with the specified *status*
|
||||||
and, if given, it prints a *message* before that. The user can override
|
and, if given, it prints a *message* to :data:`sys.stderr` before that.
|
||||||
this method to handle these steps differently::
|
The user can override this method to handle these steps differently::
|
||||||
|
|
||||||
class ErrorCatchingArgumentParser(argparse.ArgumentParser):
|
class ErrorCatchingArgumentParser(argparse.ArgumentParser):
|
||||||
def exit(self, status=0, message=None):
|
def exit(self, status=0, message=None):
|
||||||
|
@ -2201,8 +2201,8 @@ Exiting methods
|
||||||
|
|
||||||
.. method:: ArgumentParser.error(message)
|
.. method:: ArgumentParser.error(message)
|
||||||
|
|
||||||
This method prints a usage message including the *message* to the
|
This method prints a usage message, including the *message*, to
|
||||||
standard error and terminates the program with a status code of 2.
|
:data:`sys.stderr` and terminates the program with a status code of 2.
|
||||||
|
|
||||||
|
|
||||||
Intermixed parsing
|
Intermixed parsing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue