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

Misc/NEWS
Objects/classobject.c

index 7912ae4ab5bba8ef9a6d04dfde47f62ee8e4f282..d7b47c7016ef553ea059e85519422badc7ef2911 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.3.1?
 Core and builtins
 -----------------
 
+- Fixed a leak in class objects defining a comparison but not a hash
+  function.
+
 - Bug #789402, fixed memory leak when opening a file object.
 
 - Fixed a leak when new code objects are instantiated.
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;
        }