summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-09-08 09:59:13 (GMT)
committerGitHub <noreply@github.com>2021-09-08 09:59:13 (GMT)
commitcb15afcccffc6c42cbfb7456ce8db89cd2f77512 (patch)
tree1a0e5510e261f441f1bd3b7027c5ab452967288e /Modules
parent4dc4300c686f543d504ab6fa9fe600eaf11bb695 (diff)
downloadcpython-cb15afcccffc6c42cbfb7456ce8db89cd2f77512.zip
cpython-cb15afcccffc6c42cbfb7456ce8db89cd2f77512.tar.gz
cpython-cb15afcccffc6c42cbfb7456ce8db89cd2f77512.tar.bz2
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.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_testcapimodule.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 68dd285..b1e64f1 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -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;