[Python-checkins] cpython: Issue #18408: Fix PyType_Ready(), handle _PyDict_SetItemId() failure
victor.stinner
python-checkins at python.org
Wed Jul 17 22:11:58 CEST 2013
http://hg.python.org/cpython/rev/c2d90ff0780c
changeset: 84697:c2d90ff0780c
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Jul 17 22:01:37 2013 +0200
summary:
Issue #18408: Fix PyType_Ready(), handle _PyDict_SetItemId() failure
files:
Objects/typeobject.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -4256,11 +4256,15 @@
PyObject *doc = PyUnicode_FromString(type->tp_doc);
if (doc == NULL)
goto error;
- _PyDict_SetItemId(type->tp_dict, &PyId___doc__, doc);
+ if (_PyDict_SetItemId(type->tp_dict, &PyId___doc__, doc) < 0) {
+ Py_DECREF(doc);
+ goto error;
+ }
Py_DECREF(doc);
} else {
- _PyDict_SetItemId(type->tp_dict,
- &PyId___doc__, Py_None);
+ if (_PyDict_SetItemId(type->tp_dict,
+ &PyId___doc__, Py_None) < 0)
+ goto error;
}
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list