diff options
author | Christian Heimes <christian@cheimes.de> | 2013-07-31 00:36:43 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-07-31 00:36:43 (GMT) |
commit | 4efdb4177efcaf9f0fb577a95ede315a6b1c69c8 (patch) | |
tree | 02d058e9e42e19a18f9ee5be144fde673a5b9644 /Modules | |
parent | 72f455e96cba2ce446aeb1a07aafa0a549a4a90d (diff) | |
download | cpython-4efdb4177efcaf9f0fb577a95ede315a6b1c69c8.zip cpython-4efdb4177efcaf9f0fb577a95ede315a6b1c69c8.tar.gz cpython-4efdb4177efcaf9f0fb577a95ede315a6b1c69c8.tar.bz2 |
Test Py_IncRef() and Py_DecRef() C functions
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testcapimodule.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 6527a53..1ed5687 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2614,6 +2614,16 @@ test_decref_doesnt_leak(PyObject *ob) } static PyObject * +test_incref_decref_API(PyObject *ob) +{ + PyObject *obj = PyLong_FromLong(0); + Py_IncRef(ob); + Py_DecRef(obj); + Py_DecRef(obj); + Py_RETURN_NONE; +} + +static PyObject * test_pymem_alloc0(PyObject *self) { void *ptr; @@ -2781,6 +2791,7 @@ static PyMethodDef TestMethods[] = { {"test_incref_doesnt_leak", (PyCFunction)test_incref_doesnt_leak, METH_NOARGS}, {"test_xdecref_doesnt_leak",(PyCFunction)test_xdecref_doesnt_leak, METH_NOARGS}, {"test_decref_doesnt_leak", (PyCFunction)test_decref_doesnt_leak, METH_NOARGS}, + {"test_incref_decref_API", (PyCFunction)test_incref_decref_API, METH_NOARGS}, {"test_long_and_overflow", (PyCFunction)test_long_and_overflow, METH_NOARGS}, {"test_long_as_double", (PyCFunction)test_long_as_double,METH_NOARGS}, |