diff Objects/typeobject.c @ 41324:519e72d630d2

Fix refcounting bug reported by Amaury Forgeot d'Arc.
author Guido van Rossum <guido@python.org>
date Thu, 29 Mar 2007 20:49:57 +0000
parents 834da52eb2a4
children 0c5019afc55b
line wrap: on
line diff
--- a/Objects/typeobject.c	Wed Mar 28 21:44:53 2007 +0000
+++ b/Objects/typeobject.c	Thu Mar 29 20:49:57 2007 +0000
@@ -2311,6 +2311,7 @@
 
 	case Py_EQ:
 		res = (self == other) ? Py_True : Py_False;
+		Py_INCREF(res);
 		break;
 
 	case Py_NE:
@@ -2334,10 +2335,10 @@
 
 	default:
 		res = Py_NotImplemented;
+		Py_INCREF(res);
 		break;
 	}
 
-	Py_INCREF(res);
 	return res;
 }