]> granicus.if.org Git - python/commitdiff
Fix leak in classobject.c. The leak surfaced on the error exit when
authorRaymond Hettinger <python@rcn.com>
Tue, 16 Sep 2003 07:11:46 +0000 (07:11 +0000)
committerRaymond Hettinger <python@rcn.com>
Tue, 16 Sep 2003 07:11:46 +0000 (07:11 +0000)
hashing a class that does not define __hash__ but does define a
comparison.

Objects/classobject.c

index 9375e07370756def639f1a4353c294adf3d1076f..0df249de6ceafc9667409ae051c66bb435dede4c 100644 (file)
@@ -953,6 +953,7 @@ instance_hash(PyInstanceObject *inst)
                                return _Py_HashPointer(inst);
                        }
                }
+               Py_XDECREF(func);
                PyErr_SetString(PyExc_TypeError, "unhashable instance");
                return -1;
        }