Issue #15229: An OSError subclass whose __init__ doesn't call back
OSError.__init__ could produce incomplete instances, leading to crashes
when calling str() on them.
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 @@
#endif
/* Steals the reference to args */
+ Py_CLEAR(self->args);
self->args = args;
args = NULL;
@@ -916,6 +917,11 @@
))
goto error;
}
+ else {
+ self->args = PyTuple_New(0);
+ if (self->args == NULL)
+ goto error;
+ }
return (PyObject *) self;