[issue13922] argparse handling multiple -- in args improperly

2014-07-07 Thread paul j3
paul j3 added the comment: http://bugs.python.org/issue9571 proposes a refinement to this patch - drop the '--' from PARSER and REMAINDER nargs if it is the 1st string. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13922

[issue13922] argparse handling multiple -- in args improperly

2013-04-19 Thread Michele Orrù
Changes by Michele Orrù maker...@gmail.com: -- nosy: +maker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13922 ___ ___ Python-bugs-list mailing

[issue13922] argparse handling multiple -- in args improperly

2013-04-14 Thread paul j3
paul j3 added the comment: This patch removes only one '--', the one that put a '-' in the 'arg_strings_pattern'. It does this in 'consume_positionals' right before calling 'take_action'. As before it does not do this if nargs is PARSER or REMAINDER. test_argparse.py has two

[issue13922] argparse handling multiple -- in args improperly

2013-04-06 Thread paul j3
paul j3 added the comment: I am working on an alternative solution that moves the '--' removal to the consume_positionals() method, and only does it if there is a corresponding '-' in the arg_strings_pattern. -- ___ Python tracker

[issue13922] argparse handling multiple -- in args improperly

2013-04-05 Thread paul j3
paul j3 added the comment: There are several problems with the patch provided in msg156315 This description: Added patch so that only the first '--' is removed by an argparse.PARSE or argparse.REMAINDER argument. should read Added patch so that only the first '--' is removed by arguments

[issue13922] argparse handling multiple -- in args improperly

2013-04-05 Thread paul j3
paul j3 added the comment: There's another 'feature' to the patch proposed here. It only deletes the first '--' in the list of strings passed to '_get_values' for a particular action. parser = argparse.ArgumentParser() parser.add_argument('foo') parser.add_argument('bar',

[issue13922] argparse handling multiple -- in args improperly

2012-09-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5d8454fcc629 by R David Murray in branch '3.2': #15847: allow args to be a tuple in parse_args http://hg.python.org/cpython/rev/5d8454fcc629 New changeset 76655483c5c8 by R David Murray in branch 'default': merge #15847: allow args to be a tuple in

[issue13922] argparse handling multiple -- in args improperly

2012-08-21 Thread George-Cristian Bîrzan
George-Cristian Bîrzan added the comment: This patch introduced a regression. Before, parse_args would take a tuple as an argument, and in _get_values it was converted to a list via list comprehension, which meant it was working with tuples too. In the current version, that raises an

[issue13922] argparse handling multiple -- in args improperly

2012-08-21 Thread Steven Bethard
Steven Bethard added the comment: @gcbirzan: Could you please open up a new issue? The current issue is fixed - it's just that the fix caused a new issue. I would say that the `args` parameter was never intended to be anything but a list, so currently there's a documentation bug since that

[issue13922] argparse handling multiple -- in args improperly

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: This patch looks like the right fix to me. The tests look good too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13922 ___

[issue13922] argparse handling multiple -- in args improperly

2012-07-21 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 18b114be013e by R David Murray in branch '3.2': #13922: argparse no longer incorrectly strips '--' after the first one. http://hg.python.org/cpython/rev/18b114be013e New changeset bd2c167dfabc by R David Murray in

[issue13922] argparse handling multiple -- in args improperly

2012-07-21 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Committed. Thanks, Jeff. By the way, although this patch isn't big enough to require it, it would be great if you would submit a contributor agreement: http://www.python.org/psf/contrib. -- resolution: - fixed stage: -

[issue13922] argparse handling multiple -- in args improperly

2012-07-21 Thread Warren Turkal
Warren Turkal w...@penguintechs.org added the comment: Thanks for fixing this issue. You guys are great! wt On Sat, Jul 21, 2012 at 8:00 PM, R. David Murray rep...@bugs.python.orgwrote: R. David Murray rdmur...@bitdance.com added the comment: Committed. Thanks, Jeff. By the way,

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: I think it is unlikely that anyone depends on argparse consuming multiple -- strings. If you are worried about it we could restrict the change to 3.3. But personally I think this would be OK for a bug fix. -- nosy:

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Ok, I agree - I'm fine with it as a bugfix. Depending on the removal of extra -- strings would be pretty crazy anyway. ;-) -- ___ Python tracker rep...@bugs.python.org

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread Jeff Knupp
Jeff Knupp jkn...@gmail.com added the comment: I don't know that this is a bug. Rather, the string '--' means different things to argparse and optparse. In argparse, '--' is a psuedo-argument taken to mean everything after this is a postional argument and not stop processing arguments, which

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: No, it is definitely a bug. It prevents implementing parsers that pass strings on to another sub-parser or command. Imagine, for example, implementing a script that takes some arguments, but takes the entire rest of the command string

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread Eric V. Smith
Eric V. Smith e...@trueblade.com added the comment: I agree with David. It's a bug. I have programs (not using argparse yet) that do exactly what he describes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13922

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread Jeff Knupp
Jeff Knupp jkn...@gmail.com added the comment: In that case, wouldn't you use 'parse_known_args' instead of 'parse_args' and pass the remaining arguments to the next script? This case is explicitly mentioned in the argparse documentation. Again it seems to me that the meaning of '--' has changed

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread Eric V. Smith
Eric V. Smith e...@trueblade.com added the comment: No. parse_known_args assumes you have known and unknown args intermixed. Going back to the original example, what if hack and :target had overlapping parameter names (say, they both supported --arg1)? I think parse_known_args would pick up

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: It prevents implementing parsers that pass strings on to another sub-parser or command. ... wouldn't you use 'parse_known_args' instead of 'parse_args' and pass the remaining arguments to the next script I'll just say again that

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread Jeff Knupp
Jeff Knupp jkn...@gmail.com added the comment: Added patch so that only the first '--' is removed by an argparse.PARSE or argparse.REMAINDER argument. Note that, as Steven said, argparse.REMAINDER should be used in the OP's issue (and the added test makes sure all remaining arguments are

[issue13922] argparse handling multiple -- in args improperly

2012-02-15 Thread Warren Turkal
Warren Turkal w...@penguintechs.org added the comment: Using argparse.REMAINDER will not help for my problem in my real program as the first arg needs to be handled by my program and mapped into the real binary name. If I recall correctly from memory, the following is what happened when I

[issue13922] argparse handling multiple -- in args improperly

2012-02-13 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: See nargs=argparse.REMAINDER for an approach that doesn't require that first '--': http://docs.python.org/library/argparse.html#nargs But yeah, removing more than one '--' is probably a bug. Fixing it would be a little backwards

[issue13922] argparse handling multiple -- in args improperly

2012-02-10 Thread Christophe Kalt
Christophe Kalt k...@taranis.org added the comment: Hah.. was just about to report this. I'm in the midst of converting a bunch of scripts from optparse to argparse, and this is one of the problems I'm hitting. -- nosy: +kalt ___ Python tracker

[issue13922] argparse handling multiple -- in args improperly

2012-02-10 Thread Warren Turkal
Changes by Warren Turkal w...@penguintechs.org: -- versions: +Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13922 ___ ___

[issue13922] argparse handling multiple -- in args improperly

2012-02-04 Thread Warren Turkal
Warren Turkal w...@penguintechs.org added the comment: I wanted to include a minimal example script, so here it is. If you run this like so: $ ./test.py -- blah -- blah2 you will get the the following output: Namespace(args=['blah2'], target=['blah']) I would have expected the following

[issue13922] argparse handling multiple -- in args improperly

2012-02-04 Thread Warren Turkal
Warren Turkal w...@penguintechs.org added the comment: It doesn't look like that file got included last time, so here's a second try. -- Added file: http://bugs.python.org/file24424/test.py ___ Python tracker rep...@bugs.python.org

[issue13922] argparse handling multiple -- in args improperly

2012-02-02 Thread Eric V. Smith
Changes by Eric V. Smith e...@trueblade.com: -- nosy: +bethard, eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13922 ___ ___

[issue13922] argparse handling multiple -- in args improperly

2012-02-01 Thread Warren Turkal
New submission from Warren Turkal w...@penguintechs.org: I have a program that runs something like the following: $ hack run -- :target --arg1 --arg2 arg3 arg4 This basically runs a program identified by :target with the args. However, I cannot pass -- to the program. For example, if I type: $