diff Objects/typeobject.c @ 40012:ab13576374b1 2.4

[Backport r50743 | neal.norwitz] Handle allocation failures gracefully. Found with failmalloc. Many (all?) of these could be backported.
author Andrew M. Kuchling <amk@amk.ca>
date Thu, 05 Oct 2006 18:08:58 +0000
parents 13cf344de8c9
children eda931f398c0
line wrap: on
line diff
--- a/Objects/typeobject.c	Thu Oct 05 17:30:48 2006 +0000
+++ b/Objects/typeobject.c	Thu Oct 05 18:08:58 2006 +0000
@@ -3239,6 +3239,8 @@
 	if (PyDict_GetItemString(type->tp_dict, "__doc__") == NULL) {
 		if (type->tp_doc != NULL) {
 			PyObject *doc = PyString_FromString(type->tp_doc);
+			if (doc == NULL)
+				goto error;
 			PyDict_SetItemString(type->tp_dict, "__doc__", doc);
 			Py_DECREF(doc);
 		} else {