diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-02-21 20:42:48 +0100 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-02-21 20:42:48 +0100 |
commit | 776af4002bb6edf6071f0b82f0354ed7b218695e (patch) | |
tree | db9510e763e2476783eb331b9a6fb396995bc815 /Python/getopt.c | |
parent | 876e789f650a68b1fe05be7060794357cf13e3d3 (diff) | |
download | cpython-git-776af4002bb6edf6071f0b82f0354ed7b218695e.tar.gz |
Fix crash at startup with -W options.
Diffstat (limited to 'Python/getopt.c')
-rw-r--r-- | Python/getopt.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/getopt.c b/Python/getopt.c index 093c3dada2..e96eb6ccc3 100644 --- a/Python/getopt.c +++ b/Python/getopt.c @@ -37,10 +37,18 @@ extern "C" { int _PyOS_opterr = 1; /* generate error messages */ int _PyOS_optind = 1; /* index into argv array */ char *_PyOS_optarg = NULL; /* optional argument */ +static char *opt_ptr = ""; + +void _PyOS_ResetGetOpt(void) +{ + _PyOS_opterr = 1; + _PyOS_optind = 1; + _PyOS_optarg = NULL; + opt_ptr = ""; +} int _PyOS_GetOpt(int argc, char **argv, char *optstring) { - static char *opt_ptr = ""; char *ptr; int option; |