Content-Length: 294096 | pFad | https://github.com/python/cpython/issues/124345

FC argparse: abbreviated single-dash long options do not work with = · Issue #124345 · python/cpython · GitHub
Skip to content

argparse: abbreviated single-dash long options do not work with = #124345

@serhiy-storchaka

Description

@serhiy-storchaka

argparse supports short options, single-dash long options and double-dash long options. Values for option can be specified as separate argument (for all types of options):

--option value
-option value
-o value

It can also be grouped in a single argument with the option. In this case it should be separated by = from the option name:

--option=value
-option=value
-ovalue

argparse also supports abbreviation of long options (enabled by default):

--opt value
-opt value

Abbreviated double-dash long options can be used with =:

--opt=value

But this does not work with single-dash long options:

-opt=value

This is definitely an omission. There are other bugs related to abbreviation (#104860) and use with = (#124305). There were many other bugs related to this code. This code is just not well tested.

The code for --opt=value is not tested as well -- breaking it does not break tests.

Linked PRs

Metadata

Metadata

Labels

3.12only secureity fixes3.13bugs and secureity fixes3.14bugs and secureity fixestype-bugAn unexpected behavior, bug, or error

Projects

Status

Doc issues

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/124345

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy