diff --git a/Objects/listobject.c b/Objects/listobject.c index 6370ba4fbc9f89..e7c1d952579eba 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -3929,7 +3929,7 @@ listiter_dealloc(PyObject *self) _PyListIterObject *it = (_PyListIterObject *)self; _PyObject_GC_UNTRACK(it); Py_XDECREF(it->it_seq); - assert(Py_TYPE(self)==_PyListIterObject); + assert(Py_IS_TYPE(self, &PyListIter_Type)); _Py_FREELIST_FREE(list_iters, it, PyObject_GC_Del); } diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 67a8a49b03c97b..f1eb3015625f90 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -996,6 +996,7 @@ tupleiter_dealloc(PyObject *self) _PyTupleIterObject *it = _PyTupleIterObject_CAST(self); _PyObject_GC_UNTRACK(it); Py_XDECREF(it->it_seq); + assert(Py_IS_TYPE(self, &PyTupleIter_Type)); _Py_FREELIST_FREE(tuple_iters, it, PyObject_GC_Del); }