mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Test Py_IncRef() and Py_DecRef() C functions
This commit is contained in:
parent
72f455e96c
commit
4efdb4177e
1 changed files with 11 additions and 0 deletions
|
@ -2613,6 +2613,16 @@ test_decref_doesnt_leak(PyObject *ob)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 *
|
static PyObject *
|
||||||
test_pymem_alloc0(PyObject *self)
|
test_pymem_alloc0(PyObject *self)
|
||||||
{
|
{
|
||||||
|
@ -2781,6 +2791,7 @@ static PyMethodDef TestMethods[] = {
|
||||||
{"test_incref_doesnt_leak", (PyCFunction)test_incref_doesnt_leak, METH_NOARGS},
|
{"test_incref_doesnt_leak", (PyCFunction)test_incref_doesnt_leak, METH_NOARGS},
|
||||||
{"test_xdecref_doesnt_leak",(PyCFunction)test_xdecref_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_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,
|
{"test_long_and_overflow", (PyCFunction)test_long_and_overflow,
|
||||||
METH_NOARGS},
|
METH_NOARGS},
|
||||||
{"test_long_as_double", (PyCFunction)test_long_as_double,METH_NOARGS},
|
{"test_long_as_double", (PyCFunction)test_long_as_double,METH_NOARGS},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue