gh-133140: Add PyUnstable_Object_IsUniquelyReferenced for free-threading (#133144)

This commit is contained in:
Peter Bierma 2025-05-05 15:01:20 -04:00 committed by GitHub
parent 0eeaa0ef8b
commit b275b8f342
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 61 additions and 1 deletions

View file

@ -478,6 +478,13 @@ clear_managed_dict(PyObject *self, PyObject *obj)
}
static PyObject *
is_uniquely_referenced(PyObject *self, PyObject *op)
{
return PyBool_FromLong(PyUnstable_Object_IsUniquelyReferenced(op));
}
static PyMethodDef test_methods[] = {
{"call_pyobject_print", call_pyobject_print, METH_VARARGS},
{"pyobject_print_null", pyobject_print_null, METH_VARARGS},
@ -503,6 +510,7 @@ static PyMethodDef test_methods[] = {
{"test_py_is_macros", test_py_is_macros, METH_NOARGS},
{"test_py_is_funcs", test_py_is_funcs, METH_NOARGS},
{"clear_managed_dict", clear_managed_dict, METH_O, NULL},
{"is_uniquely_referenced", is_uniquely_referenced, METH_O},
{NULL},
};