mirror of
https://github.com/python/cpython.git
synced 2025-10-28 01:00:34 +00:00
bpo-39573: Add Py_SET_REFCNT() function (GH-18389)
Add a Py_SET_REFCNT() function to set the reference counter of an object.
This commit is contained in:
parent
a93c51e3a8
commit
c86a11221d
7 changed files with 30 additions and 14 deletions
|
|
@ -123,6 +123,11 @@ typedef struct {
|
|||
#define Py_TYPE(ob) (_PyObject_CAST(ob)->ob_type)
|
||||
#define Py_SIZE(ob) (_PyVarObject_CAST(ob)->ob_size)
|
||||
|
||||
static inline void _Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt) {
|
||||
ob->ob_refcnt = refcnt;
|
||||
}
|
||||
#define Py_SET_REFCNT(ob, refcnt) _Py_SET_REFCNT(_PyObject_CAST(ob), refcnt)
|
||||
|
||||
/*
|
||||
Type objects contain a string containing the type name (to help somewhat
|
||||
in debugging), the allocation parameters (see PyObject_New() and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue