summaryrefslogtreecommitdiff
path: root/Python/getopt.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-02-21 20:42:48 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2012-02-21 20:42:48 +0100
commit776af4002bb6edf6071f0b82f0354ed7b218695e (patch)
treedb9510e763e2476783eb331b9a6fb396995bc815 /Python/getopt.c
parent876e789f650a68b1fe05be7060794357cf13e3d3 (diff)
downloadcpython-git-776af4002bb6edf6071f0b82f0354ed7b218695e.tar.gz
Fix crash at startup with -W options.
Diffstat (limited to 'Python/getopt.c')
-rw-r--r--Python/getopt.c10
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;