diff --git a/Objects/listobject.c b/Objects/listobject.c --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -182,7 +182,7 @@ Py_ssize_t PyList_Size(PyObject *op) { - if (!PyList_Check(op)) { + if (!PyList_CheckExact(op) && !PyList_Check(op)) { PyErr_BadInternalCall(); return -1; } @@ -195,7 +195,7 @@ PyObject * PyList_GetItem(PyObject *op, Py_ssize_t i) { - if (!PyList_Check(op)) { + if (!PyList_CheckExact(op) && !PyList_Check(op)) { PyErr_BadInternalCall(); return NULL; } @@ -217,7 +217,7 @@ PyObject *newitem) { PyObject **p; - if (!PyList_Check(op)) { + if (!PyList_CheckExact(op) && !PyList_Check(op)) { Py_XDECREF(newitem); PyErr_BadInternalCall(); return -1; @@ -269,7 +269,7 @@ int PyList_Insert(PyObject *op, Py_ssize_t where, PyObject *newitem) { - if (!PyList_Check(op)) { + if (!PyList_CheckExact(op) && !PyList_Check(op)) { PyErr_BadInternalCall(); return -1; } @@ -299,7 +299,7 @@ int PyList_Append(PyObject *op, PyObject *newitem) { - if (PyList_Check(op) && (newitem != NULL)) + if (PyList_CheckExact(op) && PyList_Check(op) && (newitem != NULL)) return app1((PyListObject *)op, newitem); PyErr_BadInternalCall(); return -1;