GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-138697: Fix inferring dest from a single-dash long option in argparse by serhiy-storchaka · Pull Request #138699 · python/cpython

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Sep 9, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

If a short option and a single-dash long option are passed to add_argument(), dest is now inferred from the single-dash long option.

  • Issue: Inferring dest from a single-dash long option #138697

📚 Documentation preview 📚: https://cpython-previews--138699.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@serhiy-storchaka
serhiy-storchaka requested a review from savannahostrowski September 9, 2025 10:10
@serhiy-storchaka
serhiy-storchaka requested a review from AA-Turner as a code owner September 9, 2025 10:10
@bedevere-app bedevere-app Bot added the awaiting core review label Sep 9, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Sep 9, 2025
Inferring dest from a single-dash long option #138697
Closed
@serhiy-storchaka
pythongh-138697: Fix inferring dest from a single-dash long option in…
426169f
… argparse

If a short option and a single-dash long option are passed to add_argument(),
dest is now inferred from the single-dash long option.
@serhiy-storchaka
serhiy-storchaka force-pushed the argparse-single-dash-long-option-dest branch from 9987fa1 to 426169f Compare September 9, 2025 10:14
@serhiy-storchaka serhiy-storchaka linked an issue Sep 19, 2025 that may be closed by this pull request
Inferring dest from a single-dash long option #138697
Closed
@serhiy-storchaka
Merge branch 'main' into argparse-single-dash-long-option-dest
f186f0d
savannahostrowski
savannahostrowski requested changes Nov 20, 2025
View reviewed changes

@savannahostrowski savannahostrowski left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Overall, I am supportive of making dest more consistent so thanks for opening this issue and PR. However, there is one edge case that still needs to be addressed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/argparse.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting core review labels Nov 20, 2025
@bedevere-app

bedevere-app Bot commented Nov 20, 2025

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka added 2 commits November 20, 2025 09:09
@serhiy-storchaka
Merge branch 'main' into argparse-single-dash-long-option-dest
1327305
@serhiy-storchaka
Make double-dash options taking priority oved single-dash long options.
d80974d
@serhiy-storchaka

serhiy-storchaka commented Nov 20, 2025

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting change review and removed awaiting changes labels Nov 20, 2025
@bedevere-app

bedevere-app Bot commented Nov 20, 2025

Copy link
Copy Markdown

Thanks for making the requested changes!

@savannahostrowski: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app
bedevere-app Bot requested a review from savannahostrowski November 20, 2025 09:33
savannahostrowski
savannahostrowski approved these changes Nov 20, 2025
View reviewed changes

@savannahostrowski savannahostrowski left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM! Thanks for this!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting change review labels Nov 20, 2025
@savannahostrowski
Merge branch 'main' into argparse-single-dash-long-option-dest
7b75616
@savannahostrowski
savannahostrowski enabled auto-merge (squash) November 20, 2025 18:11
@savannahostrowski
savannahostrowski merged commit 77cb39e into python:main Nov 20, 2025
46 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 20, 2025
@serhiy-storchaka
serhiy-storchaka deleted the argparse-single-dash-long-option-dest branch November 20, 2025 19:26
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
@serhiy-storchaka @savannahostrowski @StanFromIreland
pythongh-138697: Fix inferring dest from a single-dash long option in…
3d5d18e
… argparse (python#138699)

* pythongh-138697: Fix inferring dest from a single-dash long option in argparse

If a short option and a single-dash long option are passed to add_argument(),
dest is now inferred from the single-dash long option.

* Make double-dash options taking priority over single-dash long options.

---------

Co-authored-by: Savannah Ostrowski <[email protected]>
ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request Dec 8, 2025
@serhiy-storchaka @savannahostrowski @ashm-dev
pythongh-138697: Fix inferring dest from a single-dash long option in…
23e14ca
… argparse (python#138699)

* pythongh-138697: Fix inferring dest from a single-dash long option in argparse

If a short option and a single-dash long option are passed to add_argument(),
dest is now inferred from the single-dash long option.

* Make double-dash options taking priority over single-dash long options.

---------

Co-authored-by: Savannah Ostrowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@savannahostrowski savannahostrowski savannahostrowski approved these changes
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Inferring dest from a single-dash long option

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@serhiy-storchaka @savannahostrowski
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.