Author gholms
Recipients gholms
Date 2013-05-02.00:43:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When it goes to format a usage message, argparse seems to (correctly) fail to satisfy one of its assertions when all of the following are true:

1. A mutually exclusive group contains only args that are suppressed
2. An unsuppressed arg follows that group
3. The usage is long enough to need to line-wrap

The cause seems to be that the set of regular expressions that argparse uses to clean up mutually exclusive groups' separators doesn't handle the space that follows what would otherwise be an empty pair of square braces, sort of like this:

1. [-h] [ ] [--spam] ...
2. [-h] [] [--spam] ...
3. [-h]  [--spam] ...

A test case is attached.  I was able to reproduce this with python-2.7.3-13.fc18.x86_64 on Fedora as well as with commit 83588:e6b962fa44bb in 3.4 mainline.  I have a small patch for the latter that I'll submit shortly.

Sorry if I missed anything.  This is my first bug report against python proper.
Date User Action Args
2013-05-02 00:43:02gholmssetrecipients: + gholms
2013-05-02 00:43:02gholmssetmessageid: <>
2013-05-02 00:43:02gholmslinkissue17890 messages
2013-05-02 00:43:01gholmscreate