Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
assert Py_TPFLAGS_DISALLOW_INSTANTIATION on initial=0
  • Loading branch information
kumaraditya303 committed Jul 4, 2025
commit 75c5ea1c69d2db6bf629c4adea7fc3492085b8c1
8 changes: 6 additions & 2 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -9018,9 +9018,13 @@ type_ready_set_new(PyTypeObject *type, int initial)
default also inherit object.__new__. */
if (type->tp_new == NULL
&& base == &PyBaseObject_Type
&& !(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && initial)
&& !(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
{
type_add_flags(type, Py_TPFLAGS_DISALLOW_INSTANTIATION);
if (initial) {
type_add_flags(type, Py_TPFLAGS_DISALLOW_INSTANTIATION);
} else {
assert(type->tp_flags & Py_TPFLAGS_DISALLOW_INSTANTIATION);
}
}

if (!(type->tp_flags & Py_TPFLAGS_DISALLOW_INSTANTIATION)) {
Expand Down
Loading