diff options
author | Victor Stinner <vstinner@python.org> | 2020-11-05 14:02:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-05 14:02:12 (GMT) |
commit | 53a03aafd5812018a3821a2e83063fd3d6cd2576 (patch) | |
tree | c38adba5e60f412a36ea31736fb6265b2f754a40 /Objects/object.c | |
parent | 80449f243b13311d660eab3a751648029bcdd833 (diff) | |
download | cpython-53a03aafd5812018a3821a2e83063fd3d6cd2576.zip cpython-53a03aafd5812018a3821a2e83063fd3d6cd2576.tar.gz cpython-53a03aafd5812018a3821a2e83063fd3d6cd2576.tar.bz2 |
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.
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c index 7bc3e48..be7790e 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -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 |