Fix refcounting bug reported by Amaury Forgeot d'Arc.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index be6f279..1ccd97b 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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;
 }