Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 29687cd

Browse files
committed
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.
1 parent c11e192 commit 29687cd

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Objects/typeobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,8 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
11521152
COPYSLOT(tp_dictoffset);
11531153
COPYSLOT(tp_init);
11541154
COPYSLOT(tp_alloc);
1155-
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
1155+
if (base != &PyBaseObject_Type ||
1156+
(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
11561157
COPYSLOT(tp_new);
11571158
}
11581159
COPYSLOT(tp_free);

0 commit comments

Comments
 (0)