This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Laszlo.Attila.Toth
Recipients Laszlo.Attila.Toth, iritkatriel
Date 2021-12-12.20:01:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1639339314.32.0.964368879522.issue46057@roundup.psfhosted.org>
In-reply-to
Content
The fix is something like this for _ArgumentGroup, but as the container may not be an _ArgumentGroup, it breaks the tests.

--- Lib/argparse.py
+++ Lib/argparse.py
@@ -1635,9 +1640,13 @@ def __init__(self, container, title=None, description=None, **kwargs):
         self._has_negative_number_optionals = \
             container._has_negative_number_optionals
         self._mutually_exclusive_groups = container._mutually_exclusive_groups
+        self._container = container

     def _add_action(self, action):
-        action = super(_ArgumentGroup, self)._add_action(action)
+        if self.title:
+            action = super(_ArgumentGroup, self)._add_action(action)
+        else:
+            action = self._container._add_action(action)
         self._group_actions.append(action)
History
Date User Action Args
2021-12-12 20:01:54Laszlo.Attila.Tothsetrecipients: + Laszlo.Attila.Toth, iritkatriel
2021-12-12 20:01:54Laszlo.Attila.Tothsetmessageid: <1639339314.32.0.964368879522.issue46057@roundup.psfhosted.org>
2021-12-12 20:01:54Laszlo.Attila.Tothlinkissue46057 messages
2021-12-12 20:01:54Laszlo.Attila.Tothcreate