mirror of
https://github.com/python/cpython.git
synced 2025-07-22 18:55:22 +00:00
bpo-39573: Add Py_SET_TYPE() function (GH-18394)
Add Py_SET_TYPE() function to set the type of an object.
This commit is contained in:
parent
daa9756cb6
commit
d2ec81a8c9
24 changed files with 77 additions and 48 deletions
|
@ -128,6 +128,12 @@ static inline void _Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt) {
|
|||
}
|
||||
#define Py_SET_REFCNT(ob, refcnt) _Py_SET_REFCNT(_PyObject_CAST(ob), refcnt)
|
||||
|
||||
static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type) {
|
||||
ob->ob_type = type;
|
||||
}
|
||||
#define Py_SET_TYPE(ob, type) _Py_SET_TYPE(_PyObject_CAST(ob), type)
|
||||
|
||||
|
||||
/*
|
||||
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