fix: duplicate subparsers being added to argparse by JohnVillalovos · Pull Request #2014 · python-gitlab/python-gitlab · GitHub
Skip to content

fix: duplicate subparsers being added to argparse - #2014

Merged
nejch merged 1 commit into
mainfrom
jlvillal/python3.11beta1
May 9, 2022
Merged

nejch merged 1 commit into
mainfrom
jlvillal/python3.11beta1

Conversation

@JohnVillalovos

@JohnVillalovos JohnVillalovos commented May 8, 2022

Copy link
Copy Markdown
Member

Python 3.11 added an additional check in the argparse libary which
detected duplicate subparsers being added. We had duplicate subparsers
being added.

Make sure we don't add duplicate subparsers.
Closes: #2015

@JohnVillalovos

Copy link
Copy Markdown
Member Author

@JohnVillalovos

Copy link
Copy Markdown
Member Author

I think this is the upstream commit:

python/cpython@ad5e852

commit ad5e8520f3e117f45481513014548a39879d30d2
Author: Antony Lee <anntzer.lee@gmail.com>
Date:   Sun May 1 08:04:50 2022 +0200

    bpo-39716: Raise on conflicting subparser names. (GH-18605)



    Raise an ArgumentError when the same subparser name is added twice to an
    ArgumentParser.  This is consistent with the (default) behavior when the
    same option string is added twice to an ArgumentParser.

    (Support for `conflict_handler="resolve"` could be considered as a
    followup feature, although real use cases seem even rarer than
    "resolve"ing option-strings.)

    Automerge-Triggered-By: GH:rhettinger

@JohnVillalovos

Copy link
Copy Markdown
Member Author

The PR upstream: python/cpython#18605

@JohnVillalovos

Copy link
Copy Markdown
Member Author

Probably should create an issue for this instead of my dummy PR 😊

@JohnVillalovos
JohnVillalovos force-pushed the jlvillal/python3.11beta1 branch 4 times, most recently from d64b159 to 14df327 Compare May 8, 2022 19:20
@JohnVillalovos JohnVillalovos changed the title WIP: testing Python 3.11.0-beta.1 fix: duplicate subparsers being added to argparse May 8, 2022
@JohnVillalovos
JohnVillalovos requested a review from nejch May 8, 2022 19:20
@JohnVillalovos
JohnVillalovos force-pushed the jlvillal/python3.11beta1 branch from 14df327 to 6f013d1 Compare May 8, 2022 19:26
@codecov-commenter

codecov-commenter commented May 8, 2022

Copy link
Copy Markdown

Codecov Report

Merging #2014 (c7dcedd) into main (6b47c26) will decrease coverage by 0.03%.
The diff coverage is 69.23%.

@@            Coverage Diff             @@
##             main    #2014      +/-   ##
==========================================
- Coverage   92.65%   92.62%   -0.04%     
==========================================
  Files          78       78              
  Lines        4944     4949       +5     
==========================================
+ Hits         4581     4584       +3     
- Misses        363      365       +2     
Flag Coverage Δ
cli_func_v4 81.39% <69.23%> (-0.03%) ⬇️
py_func_v4 80.33% <0.00%> (-0.09%) ⬇️
unit 83.53% <69.23%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/v4/cli.py 81.18% <69.23%> (-0.38%) ⬇️

Comment thread gitlab/v4/cli.py Outdated
@JohnVillalovos
JohnVillalovos force-pushed the jlvillal/python3.11beta1 branch 2 times, most recently from e812380 to c7dcedd Compare May 8, 2022 22:01
Comment thread gitlab/v4/cli.py Outdated
Comment thread gitlab/v4/cli.py
Python 3.11 added an additional check in the argparse libary which
detected duplicate subparsers being added. We had duplicate subparsers
being added.

Make sure we don't add duplicate subparsers.

Closes: #2015
@JohnVillalovos
JohnVillalovos force-pushed the jlvillal/python3.11beta1 branch from c7dcedd to f553fd3 Compare May 9, 2022 13:40
@nejch
nejch merged commit 7d5a0c9 into main May 9, 2022
@nejch
nejch deleted the jlvillal/python3.11beta1 branch May 9, 2022 14:53
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.

Python 3.11 unit tests are failing due to argparse error

3 participants