diff options
author | Savannah Ostrowski <savannahostrowski@gmail.com> | 2024-10-17 09:11:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-17 09:11:47 (GMT) |
commit | 7b04496e5c7ed47e9653f4591674fc9ffef34587 (patch) | |
tree | f3019e1f0a4db53faeb70ac91aa0d230efb400eb /Lib/argparse.py | |
parent | 624be8699aec22bef137041478078c6fafaf032e (diff) | |
download | cpython-7b04496e5c7ed47e9653f4591674fc9ffef34587.zip cpython-7b04496e5c7ed47e9653f4591674fc9ffef34587.tar.gz cpython-7b04496e5c7ed47e9653f4591674fc9ffef34587.tar.bz2 |
gh-125542: Deprecate prefix_chars in ArgumentParser.add_argument_group() (GH-125563)
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r-- | Lib/argparse.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index ece6f2e..49271a1 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1662,6 +1662,14 @@ class _ActionsContainer(object): class _ArgumentGroup(_ActionsContainer): def __init__(self, container, title=None, description=None, **kwargs): + if 'prefix_chars' in kwargs: + import warnings + depr_msg = ( + "The use of the undocumented 'prefix_chars' parameter in " + "ArgumentParser.add_argument_group() is deprecated." + ) + warnings.warn(depr_msg, DeprecationWarning, stacklevel=3) + # add any missing keyword arguments by checking the container update = kwargs.setdefault update('conflict_handler', container.conflict_handler) |