]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Check for identical types before comparing objects to see if they
authorGuido van Rossum <guido@python.org>
Mon, 1 Jul 1991 18:44:20 +0000 (18:44 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 1 Jul 1991 18:44:20 +0000 (18:44 +0000)
are the same -- 0 and 0.0 compare equal but should be considered different
here!

Python/compile.c

index 76050031552dcbe094d7f14b32e99cf9f20cf130..71d13bc2f16249db41798c5a1b5ae203a4609397 100644 (file)
@@ -292,7 +292,7 @@ com_add(c, list, v)
        int i;
        for (i = n; --i >= 0; ) {
                object *w = getlistitem(list, i);
-               if (cmpobject(v, w) == 0)
+               if (v->ob_type == w->ob_type && cmpobject(v, w) == 0)
                        return i;
        }
        if (addlistitem(list, v) != 0)