summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-12-06 23:11:07 +0100
committerVictor Stinner <vstinner@python.org>2021-12-06 23:17:33 +0100
commite902ab516087ef512ea9b3e06564cb246edcc50d (patch)
tree701149fc2df4053afc4bec5e52cdb604bc91e2bd
parent5bdc20781bf458dcafb5b5469e0a1253f067d56f (diff)
downloadswig-e902ab516087ef512ea9b3e06564cb246edcc50d.tar.gz
Add Python 3.11 support: use Py_SET_TYPE()
On Python 3.9 and newer, SwigPyBuiltin_SetMetaType() now calls Py_SET_TYPE(). Py_TYPE() can no longer be usd as an l-value on Python 3.11: * https://docs.python.org/dev/c-api/structures.html#c.Py_SET_TYPE * https://docs.python.org/dev/whatsnew/3.11.html#c-api-changes
-rw-r--r--Lib/python/builtin.swg4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg
index 4f31a8d54..ec092233d 100644
--- a/Lib/python/builtin.swg
+++ b/Lib/python/builtin.swg
@@ -414,7 +414,11 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) {
SWIGINTERN void
SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype)
{
+#if PY_VERSION_HEX >= 0x030900A4
+ Py_SET_TYPE(type, metatype);
+#else
Py_TYPE(type) = metatype;
+#endif
}