mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
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:
parent
80449f243b
commit
53a03aafd5
7 changed files with 85 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue