[3.14] gh-139736: Fix argparse indentation overshoot (GH-139738) (#139793)

gh-139736: Fix argparse indentation overshoot (GH-139738)
(cherry picked from commit 72e370c910)

Co-authored-by: ed <s@ocv.me>
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-10-08 18:02:08 +02:00 committed by GitHub
parent 4e3fc92c40
commit 14c923cc85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 7 deletions

View file

@ -281,7 +281,7 @@ def add_argument(self, action):
if action.help is not SUPPRESS:
# find all invocations
get_invocation = self._format_action_invocation
get_invocation = lambda x: self._decolor(self._format_action_invocation(x))
invocation_lengths = [len(get_invocation(action)) + self._current_indent]
for subaction in self._iter_indented_subactions(action):
invocation_lengths.append(len(get_invocation(subaction)) + self._current_indent)