[Python-checkins] r72357 - python/trunk/Modules/_testcapimodule.c

benjamin.peterson python-checkins at python.org
Tue May 5 23:09:21 CEST 2009


Author: benjamin.peterson
Date: Tue May  5 23:09:21 2009
New Revision: 72357

Log:
fix running test_capi with -R ::

Also, fix a refleak in the test that was preventing running. :)


Modified:
   python/trunk/Modules/_testcapimodule.c

Modified: python/trunk/Modules/_testcapimodule.c
==============================================================================
--- python/trunk/Modules/_testcapimodule.c	(original)
+++ python/trunk/Modules/_testcapimodule.c	Tue May  5 23:09:21 2009
@@ -226,6 +226,13 @@
 	long hash;
 
 	type = &_HashInheritanceTester_Type;
+
+        if (type->tp_dict != NULL)
+            /* The type has already been initialized. This probably means -R
+             is being used. */
+            Py_RETURN_NONE;
+
+
 	obj = PyObject_New(PyObject, type);
 	if (obj == NULL) {
 		PyErr_Clear();
@@ -269,6 +276,8 @@
 		return NULL;
 	}
 
+        Py_DECREF(obj);
+
 	Py_RETURN_NONE;
 }
 


More information about the Python-checkins mailing list