summaryrefslogtreecommitdiffstats
path: root/Modules/_testinternalcapi.c
diff options
context:
space:
mode:
authorPeter Bierma <zintensitydev@gmail.com>2024-11-13 13:27:16 (GMT)
committerGitHub <noreply@github.com>2024-11-13 13:27:16 (GMT)
commitd00878b06a05ea04790813dba70b09cc1d11bf45 (patch)
treee7508c9d7769379ae50a0f6e7572a61bb6dc952f /Modules/_testinternalcapi.c
parent29b5323c4567dc7772e1d30a7ba1cbad52fe10a9 (diff)
downloadcpython-d00878b06a05ea04790813dba70b09cc1d11bf45.zip
cpython-d00878b06a05ea04790813dba70b09cc1d11bf45.tar.gz
cpython-d00878b06a05ea04790813dba70b09cc1d11bf45.tar.bz2
gh-123619: Add an unstable C API function for enabling deferred reference counting (GH-123635)
Co-authored-by: Sam Gross <colesbury@gmail.com>
Diffstat (limited to 'Modules/_testinternalcapi.c')
-rw-r--r--Modules/_testinternalcapi.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c
index 2c1ebcb..b02f794 100644
--- a/Modules/_testinternalcapi.c
+++ b/Modules/_testinternalcapi.c
@@ -2069,6 +2069,14 @@ identify_type_slot_wrappers(PyObject *self, PyObject *Py_UNUSED(ignored))
return _PyType_GetSlotWrapperNames();
}
+
+static PyObject *
+has_deferred_refcount(PyObject *self, PyObject *op)
+{
+ return PyBool_FromLong(_PyObject_HasDeferredRefcount(op));
+}
+
+
static PyMethodDef module_functions[] = {
{"get_configs", get_configs, METH_NOARGS},
{"get_recursion_depth", get_recursion_depth, METH_NOARGS},
@@ -2165,6 +2173,7 @@ static PyMethodDef module_functions[] = {
GH_119213_GETARGS_METHODDEF
{"get_static_builtin_types", get_static_builtin_types, METH_NOARGS},
{"identify_type_slot_wrappers", identify_type_slot_wrappers, METH_NOARGS},
+ {"has_deferred_refcount", has_deferred_refcount, METH_O},
{NULL, NULL} /* sentinel */
};