changeset: 87106:61a712066770 user: Victor Stinner date: Thu Nov 14 22:31:41 2013 +0100 files: Objects/exceptions.c description: Issue #19429, #19437: fix error handling in the OSError constructor diff -r 98ac18544722 -r 61a712066770 Objects/exceptions.c --- a/Objects/exceptions.c Thu Nov 14 21:37:05 2013 +0100 +++ b/Objects/exceptions.c Thu Nov 14 22:31:41 2013 +0100 @@ -845,7 +845,7 @@ /* Steals the reference to args */ Py_CLEAR(self->args); self->args = args; - args = NULL; + *p_args = args = NULL; return 0; } @@ -885,11 +885,12 @@ PyObject *winerror = NULL; #endif + Py_INCREF(args); + if (!oserror_use_init(type)) { if (!_PyArg_NoKeywords(type->tp_name, kwds)) - return NULL; - - Py_INCREF(args); + goto error; + if (oserror_parse_args(&args, &myerrno, &strerror, &filename #ifdef MS_WINDOWS , &winerror @@ -932,6 +933,7 @@ goto error; } + Py_XDECREF(args); return (PyObject *) self; error: