Skip to content

gh-121151: Fix wrapping of long usage text of arguments inside a mutually exclusive groups in argparse #121159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 7, 2024

Conversation

hamdanal
Copy link
Contributor

@hamdanal hamdanal commented Jun 29, 2024

See the linked issue for the details. The fix here is to not group the arguments in a mutually exclusive group in a single string but to keep them separate so that they can be wrapped if necessary.

@ZeroIntensity
Copy link
Member

Looks like this patch differs from what the behavior used to be. On older versions, the op3 part looked like:

--op3 [OP3 [OP3 ...]]

But on this patch, it looks like this:

--op3 [OP3 ...] |

@hamdanal
Copy link
Contributor Author

Looks like this patch differs from what the behavior used to be. On older versions, the op3 part looked like:

--op3 [OP3 [OP3 ...]]

But on this patch, it looks like this:

--op3 [OP3 ...] |

No this was changed in Python 3.9. Which version did you use for testing?

@ZeroIntensity
Copy link
Member

Looks like this patch differs from what the behavior used to be. On older versions, the op3 part looked like:

--op3 [OP3 [OP3 ...]]

But on this patch, it looks like this:

--op3 [OP3 ...] |

No this was changed in Python 3.9. Which version did you use for testing?

It might have been 3.8, oops!

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, then.

@hamdanal
Copy link
Contributor Author

hamdanal commented Aug 3, 2024

@encukou sorry to tag you again but if you could please take a look at this PR it would be great to get it merged before the final release of 3.13 as it fixes a 3.13 regression.

@encukou
Copy link
Member

encukou commented Aug 7, 2024

Looks good, thank you!
However, it missed 3.13.0rc1, and we want as few code changes as possible between the release candidate and the final. The backport will need to wait until 3.13.1.

@encukou encukou merged commit 013a092 into python:main Aug 7, 2024
33 checks passed
@encukou encukou added the needs backport to 3.13 bugs and security fixes label Aug 7, 2024
@miss-islington-app
Copy link

Thanks @hamdanal for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 7, 2024
…ts inside a mutually exclusive groups (pythonGH-121159)

(cherry picked from commit 013a092)

Co-authored-by: Ali Hamdan <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Aug 7, 2024

GH-122777 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Aug 7, 2024
@hamdanal hamdanal deleted the argparse-wrap-mutex-usage branch August 10, 2024 12:58
blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
Yhg1s pushed a commit that referenced this pull request Sep 2, 2024
…nts inside a mutually exclusive groups (GH-121159) (#122777)

gh-121151: argparse: Fix wrapping of long usage text of arguments inside a mutually exclusive groups (GH-121159)
(cherry picked from commit 013a092)

Co-authored-by: Ali Hamdan <[email protected]>
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.

3 participants