diff options
author | Victor Stinner <vstinner@python.org> | 2020-11-05 15:02:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-05 15:02:12 +0100 |
commit | 53a03aafd5812018a3821a2e83063fd3d6cd2576 (patch) | |
tree | c38adba5e60f412a36ea31736fb6265b2f754a40 /Objects | |
parent | bpo-42266: Handle monkey-patching descriptors in LOAD_ATTR cache (GH-23157) (diff) | |
download | cpython-53a03aafd5812018a3821a2e83063fd3d6cd2576.tar.gz cpython-53a03aafd5812018a3821a2e83063fd3d6cd2576.tar.bz2 cpython-53a03aafd5812018a3821a2e83063fd3d6cd2576.zip |
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')
-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 7bc3e48d40a..be7790eefd1 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 |