From a9e14b70150d5bc064afd3144097ec0095869f10 Mon Sep 17 00:00:00 2001
From: Raymond Hettinger <python@rcn.com>
Date: Tue, 16 Sep 2003 07:11:46 +0000
Subject: Fix leak in classobject.c.  The leak surfaced on the error exit when
 hashing a class that does not define __hash__ but does define a comparison.

---
 Objects/classobject.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Objects/classobject.c b/Objects/classobject.c
index 9375e07..0df249d 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -953,6 +953,7 @@ instance_hash(PyInstanceObject *inst)
 				return _Py_HashPointer(inst);
 			}
 		}
+		Py_XDECREF(func);
 		PyErr_SetString(PyExc_TypeError, "unhashable instance");
 		return -1;
 	}
-- 
cgit v0.12

