summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-06-03 16:42:59 (GMT)
committerGitHub <noreply@github.com>2021-06-03 16:42:59 (GMT)
commitf3fa63ec75fdbb4a08a10957a5c631bf0c4a5970 (patch)
tree7e87d8e48debfad12ff2cd79637ca1eb03af6ca0 /Modules
parentd88b47b5a396aa8d66f9a0e6b13a0825d59d0eff (diff)
downloadcpython-f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970.zip
cpython-f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970.tar.gz
cpython-f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970.tar.bz2
bpo-39573: Py_TYPE becomes a static inline function (GH-26493)
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 ab47949..9b106a5 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -5423,10 +5423,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;