mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-39573: Py_TYPE becomes a static inline function (GH-28128)
Convert the Py_TYPE() and Py_SIZE() macros to static inline functions. The Py_SET_TYPE() and Py_SET_SIZE() functions must now be used to set an object type and size.
This commit is contained in:
parent
4dc4300c68
commit
cb15afcccf
5 changed files with 52 additions and 9 deletions
|
@ -5511,10 +5511,9 @@ test_set_type_size(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
assert(Py_TYPE(obj) == &PyList_Type);
|
||||
assert(Py_SIZE(obj) == 0);
|
||||
|
||||
// bpo-39573: Check that Py_TYPE() and Py_SIZE() can be used
|
||||
// as l-values to set an object type and size.
|
||||
Py_TYPE(obj) = &PyList_Type;
|
||||
Py_SIZE(obj) = 0;
|
||||
// bpo-39573: Test Py_SET_TYPE() and Py_SET_SIZE() functions.
|
||||
Py_SET_TYPE(obj, &PyList_Type);
|
||||
Py_SET_SIZE(obj, 0);
|
||||
|
||||
Py_DECREF(obj);
|
||||
Py_RETURN_NONE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue