]> granicus.if.org Git - python/commitdiff
Introduced the oddly-missing PyList_CheckExact(), and used it to replace
authorTim Peters <tim.peters@gmail.com>
Fri, 5 Oct 2001 20:41:38 +0000 (20:41 +0000)
committerTim Peters <tim.peters@gmail.com>
Fri, 5 Oct 2001 20:41:38 +0000 (20:41 +0000)
a hard-coded type check.

Include/listobject.h
Python/ceval.c

index af1368c987b298bec197b95ae353f3dd6ba2bd90..1befe86de26aab3a1f2e47c30418910fbd914570 100644 (file)
@@ -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 *);
index b3e35c2935d5aa233aa795d48289804542edab96..25ba4a0ff370487b6960c33ca6230e89ad6736e5 100644 (file)
@@ -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)