]> granicus.if.org Git - python/commitdiff
fix running test_capi with -R ::
authorBenjamin Peterson <benjamin@python.org>
Tue, 5 May 2009 21:09:21 +0000 (21:09 +0000)
committerBenjamin Peterson <benjamin@python.org>
Tue, 5 May 2009 21:09:21 +0000 (21:09 +0000)
Also, fix a refleak in the test that was preventing running. :)

Modules/_testcapimodule.c

index d187c5b68e7e61a2bdc9ef6814ff2b3c07d17041..19bb1a6b65c6da716ba3a56188aab8f43faa0bad 100644 (file)
@@ -226,6 +226,13 @@ test_lazy_hash_inheritance(PyObject* self)
        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 @@ test_lazy_hash_inheritance(PyObject* self)
                return NULL;
        }
 
+        Py_DECREF(obj);
+
        Py_RETURN_NONE;
 }