bpo-42262: Add Py_NewRef() and Py_XNewRef() (GH-23152)

Added Py_NewRef() and Py_XNewRef() functions to increment the reference
count of an object and return the object.
This commit is contained in:
Victor Stinner 2020-11-05 15:02:12 +01:00 committed by GitHub
parent 80449f243b
commit 53a03aafd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 85 additions and 6 deletions

View file

@ -2208,6 +2208,22 @@ PyObject_GET_WEAKREFS_LISTPTR(PyObject *op)
}
#undef Py_NewRef
#undef Py_XNewRef
// Export Py_NewRef() and Py_XNewRef() as regular functions for the stable ABI.
PyObject*
Py_NewRef(PyObject *obj)
{
return _Py_NewRef(obj);
}
PyObject*
Py_XNewRef(PyObject *obj)
{
return _Py_XNewRef(obj);
}
#ifdef __cplusplus
}
#endif