]> granicus.if.org Git - python/commitdiff
Merged revisions 72357 via svnmerge from
authorBenjamin Peterson <benjamin@python.org>
Tue, 5 May 2009 21:11:54 +0000 (21:11 +0000)
committerBenjamin Peterson <benjamin@python.org>
Tue, 5 May 2009 21:11:54 +0000 (21:11 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72357 | benjamin.peterson | 2009-05-05 16:09:21 -0500 (Tue, 05 May 2009) | 4 lines

  fix running test_capi with -R ::

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

Modules/_testcapimodule.c

index 1cbb825236cb88e594c2584bb4387a111e089cb8..3f7190ceaadde2e2d7c45a418c875c05a497fd56 100644 (file)
@@ -227,6 +227,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();
@@ -270,6 +277,8 @@ test_lazy_hash_inheritance(PyObject* self)
                return NULL;
        }
 
+        Py_DECREF(obj);
+
        Py_RETURN_NONE;
 }