summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Python/getopt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/getopt.c b/Python/getopt.c
index 5175e0a..c5a3f62 100644
--- a/Python/getopt.c
+++ b/Python/getopt.c
@@ -55,7 +55,8 @@ int getopt( int argc, char *const *argv, const char *optstring )
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) {