New submission from Wang Chun <[EMAIL PROTECTED]>: 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$ ---------- components: Library (Lib) messages: 77597 nosy: wangchun severity: normal status: open title: getopt should not accept no_argument that ends with '=' type: behavior versions: Python 2.1.1, Python 2.1.2, Python 2.2, Python 2.2.1, Python 2.2.2, Python 2.2.3, Python 2.3, Python 2.4, Python 2.5, Python 2.5.3, Python 2.6, Python 2.7, Python 3.0, Python 3.1 _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4629> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com