summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index f706698..5c85f10 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -834,6 +834,7 @@ oserror_init(PyOSErrorObject *self, PyObject **p_args,
#endif
/* Steals the reference to args */
+ Py_CLEAR(self->args);
self->args = args;
args = NULL;
@@ -916,6 +917,11 @@ OSError_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
))
goto error;
}
+ else {
+ self->args = PyTuple_New(0);
+ if (self->args == NULL)
+ goto error;
+ }
return (PyObject *) self;