mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Issue #4629: getopt raises an error if an argument ends with = whereas getopt
doesn't except a value (eg. --help= is rejected if getopt uses ['help='] long options).
This commit is contained in:
parent
a565874cc1
commit
eccc5facd3
3 changed files with 11 additions and 1 deletions
|
@ -156,7 +156,7 @@ def do_longs(opts, opt, longopts, args):
|
|||
if not args:
|
||||
raise GetoptError('option --%s requires argument' % opt, opt)
|
||||
optarg, args = args[0], args[1:]
|
||||
elif optarg:
|
||||
elif optarg is not None:
|
||||
raise GetoptError('option --%s must not have an argument' % opt, opt)
|
||||
opts.append(('--' + opt, optarg or ''))
|
||||
return opts, args
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue