From e28108cbd71d75e545c7364b16ed47c1271eb36a Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sun, 29 Jan 2012 20:13:18 -0500 Subject: [PATCH 1/2] adjust declaration --- Objects/typeobject.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index de1e445ec09..e2316bd0ad4 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2347,7 +2347,8 @@ static short slotoffsets[] = { #include "typeslots.inc" }; -PyObject* PyType_FromSpec(PyType_Spec *spec) +PyObject * +PyType_FromSpec(PyType_Spec *spec) { PyHeapTypeObject *res = (PyHeapTypeObject*)PyType_GenericAlloc(&PyType_Type, 0); char *res_start = (char*)res; From 2652d2570ea2d34fc790ef99ebd0c3c321fb86cb Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sun, 29 Jan 2012 20:16:37 -0500 Subject: [PATCH 2/2] ready types returned from PyType_FromSpec --- Misc/NEWS | 2 ++ Objects/typeobject.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index 1287d2d8a54..40a4495d84b 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ What's New in Python 3.2.3? Core and Builtins ----------------- +- Issue #13908: Ready types returned from PyType_FromSpec. + - Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp. diff --git a/Objects/typeobject.c b/Objects/typeobject.c index e2316bd0ad4..c3822abb0e0 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2386,6 +2386,9 @@ PyType_FromSpec(PyType_Spec *spec) } } + if (PyType_Ready(&res->ht_type) < 0) + goto fail; + return (PyObject*)res; fail: