Skip to content

gh-134970: Fix exception message in argparse module #134971

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 1 commit into from
Jun 1, 2025

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented May 31, 2025

Fix the "unknown action" exception in argparse.ArgumentParser.add_argument_group() to correctly replace the action class.

Fix the "unknown action" exception
in `argparse.ArgumentParser.add_argument_group()` to correctly replace
the action class.
@mgorny mgorny requested a review from savannahostrowski as a code owner May 31, 2025 10:09
mgorny added a commit to mgorny/snakeoil that referenced this pull request May 31, 2025
Loosen the argparse exception check to fix tests with Python 3.14.
Starting with Python 3.14, the exception is supposed to use single
quotes rather than double quotes.  However, due to
python/cpython#134971 it currently does not
include the name at all -- an easy way to get compatibility for both
quoting variants and to work around the bug is to not check the name
at all.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
mgorny added a commit to mgorny/snakeoil that referenced this pull request May 31, 2025
Loosen the argparse exception check to fix tests with Python 3.14.
Starting with Python 3.14, the exception is supposed to use single
quotes rather than double quotes.  However, due to
python/cpython#134971 it currently does not
include the name at all -- an easy way to get compatibility for both
quoting variants and to work around the bug is to not check the name
at all.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
gentoo-bot pushed a commit to pkgcore/snakeoil that referenced this pull request May 31, 2025
Loosen the argparse exception check to fix tests with Python 3.14.
Starting with Python 3.14, the exception is supposed to use single
quotes rather than double quotes.  However, due to
python/cpython#134971 it currently does not
include the name at all -- an easy way to get compatibility for both
quoting variants and to work around the bug is to not check the name
at all.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
Part-of: #105
Closes: #105
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
@ZeroIntensity ZeroIntensity added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels May 31, 2025
Copy link
Member

@savannahostrowski savannahostrowski left a comment

Choose a reason for hiding this comment

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

Oh good catch, thanks for this!

@savannahostrowski
Copy link
Member

@ZeroIntensity I think this just needs a backport to 3.14, since this was something @serhiy-storchaka updated for alpha 2.

@serhiy-storchaka serhiy-storchaka merged commit 965c480 into python:main Jun 1, 2025
49 checks passed
@miss-islington-app
Copy link

Thanks @mgorny for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 1, 2025
…34971)

Fix the "unknown action" exception in argparse.ArgumentParser.add_argument_group()
to correctly replace the action class.
(cherry picked from commit 965c480)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
@miss-islington-app
Copy link

Sorry, @mgorny and @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 965c48056633d3f4b41520c8cd07f0275f00fb4c 3.13

@bedevere-app
Copy link

bedevere-app bot commented Jun 1, 2025

GH-134991 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jun 1, 2025
@serhiy-storchaka serhiy-storchaka removed the needs backport to 3.13 bugs and security fixes label Jun 1, 2025
@serhiy-storchaka serhiy-storchaka removed their assignment Jun 1, 2025
serhiy-storchaka pushed a commit that referenced this pull request Jun 1, 2025
GH-134991)

Fix the "unknown action" exception in argparse.ArgumentParser.add_argument_group()
to correctly replace the action class.
(cherry picked from commit 965c480)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
@ZeroIntensity
Copy link
Member

@ZeroIntensity I think this just needs a backport to 3.14, since this was something @serhiy-storchaka updated for alpha 2.

Thanks, missed that.

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.

4 participants