summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/_testcapimodule.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 665d375..238e494 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;
}