[Python-checkins] cpython: Test Py_IncRef() and Py_DecRef() C functions

christian.heimes python-checkins at python.org
Wed Jul 31 02:36:50 CEST 2013


http://hg.python.org/cpython/rev/5cea8bc7bc7f
changeset:   84925:5cea8bc7bc7f
user:        Christian Heimes <christian at cheimes.de>
date:        Wed Jul 31 02:36:43 2013 +0200
summary:
  Test Py_IncRef() and Py_DecRef() C functions

files:
  Modules/_testcapimodule.c |  11 +++++++++++
  1 files changed, 11 insertions(+), 0 deletions(-)


diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -2614,6 +2614,16 @@
 }
 
 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 @@
     {"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},

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list