https://github.com/python/cpython/commit/8cb34fa96a60e7aca0bef6298a6c9b9f71fc1db6
commit: 8cb34fa96a60e7aca0bef6298a6c9b9f71fc1db6
branch: 3.14
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-11-05T00:46:44Z
summary:
[3.14] gh-161185: Fix test_cext: replace PyType_FromSlots() with
PyType_FromSpec() (#161373)
gh-161185: Fix test_cext: replace PyType_FromSlots() with PyType_FromSpec()
Replace PyType_FromSlots() with PyType_FromSpec(), and replace PySlot
with PyType_Spec. Python 3.14 doesn't support PyType_FromSlots(), it
has been added to Python 3.15.
files:
M Lib/test/test_cext/extension.c
diff --git a/Lib/test/test_cext/extension.c b/Lib/test/test_cext/extension.c
index 20df15998e4b85..a67c4afa782cf1 100644
--- a/Lib/test/test_cext/extension.c
+++ b/Lib/test/test_cext/extension.c
@@ -172,26 +172,32 @@ xsetref_strict_aliasing(PyTypeObject **a, PyTypeObject
**b,
Py_XSETREF(*b, second);
}
+static PyType_Slot empty_type_slots[] = {
+ {0, 0},
+};
+
+static PyType_Spec setref_type_spec = {
+ STR(MODULE_NAME) ".setref_type", // .name
+ 0, // .basicsize
+ 0, // .itemsize
+ Py_TPFLAGS_DEFAULT, // .flags
+ empty_type_slots, // .slots
+};
// gh-161185: Test that Py_SETREF(), Py_XSETREF() and Py_CLEAR() macros
// have no strict aliasing issue
static PyObject *
test_setref_strict_aliasing(PyObject *Py_UNUSED(module), PyObject
*Py_UNUSED(args))
{
- PySlot slots[] = {
- PySlot_PTR_STATIC(Py_tp_name, STR(MODULE_NAME) ".setref_type"),
- PySlot_PTR_STATIC(Py_tp_flags, Py_TPFLAGS_DEFAULT),
- PySlot_END
- };
PyObject *first, *second;
Py_ssize_t first_refcnt, second_refcnt;
PyTypeObject *slot = NULL;
- first = PyType_FromSlots(slots);
+ first = PyType_FromSpec(&setref_type_spec);
if (first == NULL) {
return NULL;
}
- second = PyType_FromSlots(slots);
+ second = PyType_FromSpec(&setref_type_spec);
if (second == NULL) {
Py_DECREF(first);
return NULL;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]