]> granicus.if.org Git - python/commitdiff
Sigh. Strengthen the resriction of the previous checkin: tp_new is
authorGuido van Rossum <guido@python.org>
Thu, 9 Aug 2001 19:43:37 +0000 (19:43 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 9 Aug 2001 19:43:37 +0000 (19:43 +0000)
inherited unless *both*: (a) the base type is 'object', and (b) the
subtype is not a "heap" type.

Objects/typeobject.c

index 7076b3631b3990734f1edeb796b3075719529301..157f0c90e09627e3067b0371ea657b5864405f9b 100644 (file)
@@ -1152,7 +1152,8 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
                COPYSLOT(tp_dictoffset);
                COPYSLOT(tp_init);
                COPYSLOT(tp_alloc);
-               if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
+               if (base != &PyBaseObject_Type ||
+                   (type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
                        COPYSLOT(tp_new);
                }
                COPYSLOT(tp_free);