From 285cfccecba911531b37b8a7dde45bf07d3cf9b0 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 18 May 2004 18:15:03 +0000 Subject: Make type check work with subclasses --- Modules/collectionsmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/collectionsmodule.c b/Modules/collectionsmodule.c index e49224d..368f0b6 100644 --- a/Modules/collectionsmodule.c +++ b/Modules/collectionsmodule.c @@ -587,7 +587,8 @@ deque_richcompare(PyObject *v, PyObject *w, int op) PyObject *it1=NULL, *it2=NULL, *x, *y; int i, b, vs, ws, minlen, cmp=-1; - if (v->ob_type != &deque_type || w->ob_type != &deque_type) { + if (!PyObject_TypeCheck(v, &deque_type) || + !PyObject_TypeCheck(w, &deque_type)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } -- cgit v0.12