[Python-checkins] cpython (merge 3.2 -> default): merge 3.2 (closes #13908)

benjamin.peterson python-checkins at python.org
Mon Jan 30 02:17:16 CET 2012


http://hg.python.org/cpython/rev/53b8f55e08bd
changeset:   74686:53b8f55e08bd
parent:      74683:5b42aefb8969
parent:      74685:e858bb04f7e7
user:        Benjamin Peterson <benjamin at python.org>
date:        Sun Jan 29 20:17:07 2012 -0500
summary:
  merge 3.2 (closes #13908)

files:
  Misc/NEWS            |  2 ++
  Objects/typeobject.c |  6 +++++-
  2 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,8 @@
 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
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2394,7 +2394,8 @@
 #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;
@@ -2434,6 +2435,9 @@
         }
     }
 
+    if (PyType_Ready(&res->ht_type) < 0)
+        goto fail;
+
     return (PyObject*)res;
 
  fail:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list