Antoine Pitrou <pit...@free.fr> added the comment:

Here is a quick patch (needs a test):

diff --git a/Objects/exceptions.c b/Objects/exceptions.c
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -834,6 +834,7 @@ oserror_init(PyOSErrorObject *self, PyOb
 #endif
 
     /* Steals the reference to args */
+    Py_CLEAR(self->args);
     self->args = args;
     args = NULL;
 
@@ -916,6 +917,11 @@ OSError_new(PyTypeObject *type, PyObject
             ))
             goto error;
     }
+    else {
+        self->args = PyTuple_New(0);
+        if (self->args == NULL)
+            goto error;
+    }
 
     return (PyObject *) self;

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15229>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to