Mercurial > cpython-lru_cache-weakref
diff Python/getopt.c @ 11278:3b981eacad7b legacy-trunk
Tim Peters discovered a bug in the Python-supplied getopt():
it doesn't recognize a lone dash as a non-flag argument.
Now it does.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 13 Sep 1999 13:45:32 +0000 |
| parents | 4e15d175eed0 |
| children | f79434ee41fa |
line wrap: on
line diff
--- a/Python/getopt.c Mon Sep 13 03:12:53 1999 +0000 +++ b/Python/getopt.c Mon Sep 13 13:45:32 1999 +0000 @@ -55,7 +55,8 @@ if (*opt_ptr == '\0') { - if (optind >= argc || argv[optind][0] != '-') + if (optind >= argc || argv[optind][0] != '-' || + argv[optind][1] == '\0' /* lone dash */ ) return -1; else if (strcmp(argv[optind], "--") == 0) {
