diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-05 21:09:21 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-05 21:09:21 (GMT) |
commit | a98c8e1d2d3452bcadd8337cc98fb279f443ad51 (patch) | |
tree | a2c8f4550a64dfa051c9f0b1c08b9fbc3eabd465 /Modules | |
parent | a57773e4838112ab44e55d985b68810fecf934a3 (diff) | |
download | cpython-a98c8e1d2d3452bcadd8337cc98fb279f443ad51.zip cpython-a98c8e1d2d3452bcadd8337cc98fb279f443ad51.tar.gz cpython-a98c8e1d2d3452bcadd8337cc98fb279f443ad51.tar.bz2 |
fix running test_capi with -R ::
Also, fix a refleak in the test that was preventing running. :)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testcapimodule.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index d187c5b..19bb1a6 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; } |