From: Benjamin Peterson Date: Tue, 5 May 2009 21:09:21 +0000 (+0000) Subject: fix running test_capi with -R :: X-Git-Tag: v2.7a1~1271 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a98c8e1d2d3452bcadd8337cc98fb279f443ad51;p=python fix running test_capi with -R :: Also, fix a refleak in the test that was preventing running. :) --- diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index d187c5b68e..19bb1a6b65 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -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; }