[issue41534] argparse : allow_abbrev behavior between 3.7 and 3.8

2020-08-24 Thread r1kk3r


r1kk3r  added the comment:

Another issue:

parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument('-verbose', type=int, required=True, dest="bla", help="bla")
known_args, rest_of_args = parser.parse_known_args(["-v", "-verbose=2"])

With python 3.8.5

test.py: error: argument -verbose: expected one argument

With python 3.7.8




This is really annoying. Argparse tries to do "smart" things where it 
shouldn't. I want it to parse -verbose, I never told him that -v is an alias 
for -verbose...

--

___
Python tracker 
<https://bugs.python.org/issue41534>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41534] argparse : allow_abbrev behavior between 3.7 and 3.8

2020-08-12 Thread r1kk3r


New submission from r1kk3r :

I looked into changelog and the source code to see if the behavior was wanted 
but I was not able to see the source of the issue.

import argparse
parser = argparse.ArgumentParser(allow_abbrev=True)
parser.add_argument('-o', type=str, required=True, dest="bla", help="bla")
known_args, rest_of_args = parser.parse_known_args(["-o", "test1", 
"-object_lto", "test2"])
print(rest_of_args)

Executing with python 3.7.8

With allow_abbrev=True:

['test2']

allow_abbrev=False:

['-object_lto', 'test2']


Executed with python 3.8.5

With allow_abbrev=True:

['test2']

allow_abbrev=False:

['test2']


Is it expected? How do I get the behavior of python 3.7 in python 3.8?

--
components: Library (Lib)
messages: 375276
nosy: r1kk3r
priority: normal
severity: normal
status: open
title: argparse : allow_abbrev behavior between 3.7 and 3.8
type: behavior
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue41534>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com