From 29687cd2112c540a8a4d31cf3b191cf10db08412 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 9 Aug 2001 19:43:37 +0000 Subject: [PATCH] Sigh. Strengthen the resriction of the previous checkin: tp_new is inherited unless *both*: (a) the base type is 'object', and (b) the subtype is not a "heap" type. --- Objects/typeobject.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 7076b3631b3..157f0c90e09 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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);