]> granicus.if.org Git - python/commitdiff
Fix and test for an infinite C recursion.
authorArmin Rigo <arigo@tunes.org>
Wed, 9 Aug 2006 14:55:26 +0000 (14:55 +0000)
committerArmin Rigo <arigo@tunes.org>
Wed, 9 Aug 2006 14:55:26 +0000 (14:55 +0000)
Lib/test/test_builtin.py
Objects/typeobject.c

index 26bfe877a1e369d52d3a7624b8d47422e44c307e..ca7a8f38c0b4ec9b866a16c3f7ff0ecd23c7b1cb 100644 (file)
@@ -649,6 +649,10 @@ class BuiltinTest(unittest.TestCase):
             def __hash__(self):
                 return 2**100
         self.assertEquals(type(hash(Y())), int)
+        class Z(long):
+            def __hash__(self):
+                return self
+        self.assertEquals(hash(Z(42)), hash(42L))
 
     def test_hex(self):
         self.assertEqual(hex(16), '0x10')
index 652009b0d60d2ff8711b30c3bb08efadeb5de131..485d2bb59df0f332b1b3b4bf6ddb7f73625f5f7f 100644 (file)
@@ -4560,7 +4560,7 @@ slot_tp_hash(PyObject *self)
                if (res == NULL)
                        return -1;
                if (PyLong_Check(res))
-                       h = res->ob_type->tp_hash(res);
+                       h = PyLong_Type.tp_hash(res);
                else
                        h = PyInt_AsLong(res);
                Py_DECREF(res);