@@ -100,15 +100,13 @@ PyType_Modified(PyTypeObject *type)
100100static void
101101type_mro_modified (PyTypeObject * type , PyObject * bases ) {
102102 /*
103- Check that all base classes or elements of the mro of type are
103+ Check that all base classes or elements of the MRO of type are
104104 able to be cached. This function is called after the base
105105 classes or mro of the type are altered.
106106
107107 Unset HAVE_VERSION_TAG and VALID_VERSION_TAG if the type
108- inherits from an old-style class, either directly or if it
109- appears in the MRO of a new-style class. No support either for
110- custom MROs that include types that are not officially super
111- types.
108+ has a custom MRO that includes a type which is not officially
109+ super type.
112110
113111 Called from mro_internal, which will subsequently be called on
114112 each subclass when their mro is recursively updated.
@@ -124,11 +122,7 @@ type_mro_modified(PyTypeObject *type, PyObject *bases) {
124122 PyObject * b = PyTuple_GET_ITEM (bases , i );
125123 PyTypeObject * cls ;
126124
127- if (!PyType_Check (b ) ) {
128- clear = 1 ;
129- break ;
130- }
131-
125+ assert (PyType_Check (b ));
132126 cls = (PyTypeObject * )b ;
133127
134128 if (!PyType_HasFeature (cls , Py_TPFLAGS_HAVE_VERSION_TAG ) ||
@@ -488,7 +482,7 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context)
488482 if (!PyType_Check (ob )) {
489483 PyErr_Format (
490484 PyExc_TypeError ,
491- "%s.__bases__ must be tuple of old- or new-style classes, not '%s'" ,
485+ "%s.__bases__ must be tuple of classes, not '%s'" ,
492486 type -> tp_name , Py_TYPE (ob )-> tp_name );
493487 return -1 ;
494488 }
@@ -1619,7 +1613,7 @@ mro_internal(PyTypeObject *type)
16191613 type -> tp_mro = tuple ;
16201614
16211615 type_mro_modified (type , type -> tp_mro );
1622- /* corner case: the old-style super class might have been hidden
1616+ /* corner case: the super class might have been hidden
16231617 from the custom MRO */
16241618 type_mro_modified (type , type -> tp_bases );
16251619
@@ -1676,9 +1670,8 @@ best_base(PyObject *bases)
16761670 return NULL ;
16771671 }
16781672 }
1679- if (base == NULL )
1680- PyErr_SetString (PyExc_TypeError ,
1681- "a new-style class can't have only classic bases" );
1673+ assert (base != NULL );
1674+
16821675 return base ;
16831676}
16841677
@@ -3196,7 +3189,7 @@ object_set_class(PyObject *self, PyObject *value, void *closure)
31963189 }
31973190 if (!PyType_Check (value )) {
31983191 PyErr_Format (PyExc_TypeError ,
3199- "__class__ must be set to new-style class, not '%s' object" ,
3192+ "__class__ must be set to a class, not '%s' object" ,
32003193 Py_TYPE (value )-> tp_name );
32013194 return -1 ;
32023195 }
@@ -3811,8 +3804,8 @@ inherit_special(PyTypeObject *type, PyTypeObject *base)
38113804 that the extension type's own factory function ensures).
38123805 Heap types, of course, are under our control, so they do
38133806 inherit tp_new; static extension types that specify some
3814- other built-in type as the default are considered
3815- new-style-aware so they also inherit object.__new__. */
3807+ other built-in type as the default also
3808+ inherit object.__new__. */
38163809 if (base != & PyBaseObject_Type ||
38173810 (type -> tp_flags & Py_TPFLAGS_HEAPTYPE )) {
38183811 if (type -> tp_new == NULL )
@@ -6352,7 +6345,7 @@ supercheck(PyTypeObject *type, PyObject *obj)
63526345{
63536346 /* Check that a super() call makes sense. Return a type object.
63546347
6355- obj can be a new-style class, or an instance of one:
6348+ obj can be a class, or an instance of one:
63566349
63576350 - If it is a class, it must be a subclass of 'type'. This case is
63586351 used for class methods; the return value is obj.
0 commit comments