Commit c9b698f3 authored by Tim Peters's avatar Tim Peters

Introduced the oddly-missing PyList_CheckExact(), and used it to replace

a hard-coded type check.
parent 22ff0e82
......@@ -27,6 +27,7 @@ typedef struct {
extern DL_IMPORT(PyTypeObject) PyList_Type;
#define PyList_Check(op) PyObject_TypeCheck(op, &PyList_Type)
#define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type)
extern DL_IMPORT(PyObject *) PyList_New(int size);
extern DL_IMPORT(int) PyList_Size(PyObject *);
......
......@@ -989,7 +989,7 @@ eval_frame(PyFrameObject *f)
case BINARY_SUBSCR:
w = POP();
v = POP();
if (v->ob_type == &PyList_Type && PyInt_CheckExact(w)) {
if (PyList_CheckExact(v) && PyInt_CheckExact(w)) {
/* INLINE: list[int] */
long i = PyInt_AsLong(w);
if (i < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment