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.
This commit is contained in:
Guido van Rossum 2001-08-09 19:43:37 +00:00
parent c11e192d41
commit 29687cd211
1 changed files with 2 additions and 1 deletions

View 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);