This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wangchun
Recipients wangchun
Date 2008-12-11.06:54:15
SpamBayes Score 0.0018217737
Marked as misclassified No
Message-id <1228978458.01.0.0804138423997.issue4629@psf.upfronthosting.co.za>
In-reply-to
Content
Consider the following program tmp.py:

import sys, getopt
print(getopt.getopt(sys.argv[1:], '', ['help']))

The program accept "--help" without a value:

python helloworld.py --help

But if someone invoke the program like:

python helloworld.py --help=

Python should raise an error.

"--help=" is not considered as no_argument in libc's getopt implementation (tested on Mac OS X 
Leopard):

#include <getopt.h>

static struct option longopts[] = { 
        { "help", no_argument, NULL, "h" },
};

#include <getopt.h>

static struct option longopts[] = { 
        { "help", no_argument, NULL, 'h' },
};

int main(int argc, char **argv)
{
        while (getopt_long(argc, argv, "h", longopts, NULL) != -1);
        return 0;
}

macbook:~/tmp$ gcc -o tmp tmp.c
macbook:~/tmp$ ./tmp --help=
tmp: option `--help' doesn't allow an argument
macbook:~/tmp$
History
Date User Action Args
2008-12-11 06:54:18wangchunsetrecipients: + wangchun
2008-12-11 06:54:18wangchunsetmessageid: <1228978458.01.0.0804138423997.issue4629@psf.upfronthosting.co.za>
2008-12-11 06:54:17wangchunlinkissue4629 messages
2008-12-11 06:54:15wangchuncreate