We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5d1d9b5 commit 75c5ea1Copy full SHA for 75c5ea1
1 file changed
Objects/typeobject.c
@@ -9018,9 +9018,13 @@ type_ready_set_new(PyTypeObject *type, int initial)
9018
default also inherit object.__new__. */
9019
if (type->tp_new == NULL
9020
&& base == &PyBaseObject_Type
9021
- && !(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && initial)
+ && !(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
9022
{
9023
- type_add_flags(type, Py_TPFLAGS_DISALLOW_INSTANTIATION);
+ if (initial) {
9024
+ type_add_flags(type, Py_TPFLAGS_DISALLOW_INSTANTIATION);
9025
+ } else {
9026
+ assert(type->tp_flags & Py_TPFLAGS_DISALLOW_INSTANTIATION);
9027
+ }
9028
}
9029
9030
if (!(type->tp_flags & Py_TPFLAGS_DISALLOW_INSTANTIATION)) {
0 commit comments