From ec5de7b7f1c333868dd0741131fb556fb6db558b Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 22 Sep 2024 02:38:33 +0200 Subject: [PATCH] Compatibility with Python 3.13. --- src/pya/pya/pyaModule.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pya/pya/pyaModule.cc b/src/pya/pya/pyaModule.cc index 86fa88fba..2825fad25 100644 --- a/src/pya/pya/pyaModule.cc +++ b/src/pya/pya/pyaModule.cc @@ -334,6 +334,10 @@ public: // Customize if (! as_static) { +#if PY_VERSION_HEX >= 0x030D0000 + // crashes with this option set + type->tp_flags &= ~Py_TPFLAGS_INLINE_VALUES; +#endif type->tp_basicsize += sizeof (PYAObjectBase); type->tp_init = &pya_object_init; type->tp_new = &pya_object_new; @@ -653,8 +657,8 @@ public: PyObject *desc = PYAAmbiguousMethodDispatcher::create (attr_inst, attr_class); PythonRef name (c2python (*a)); - // Note: we use GenericSetAttr since that one allows us setting attributes on built-in types - PyObject_GenericSetAttr ((PyObject *) type, name.get (), desc); + // Note: we use the setattro function since that one allows us setting attributes on built-in types + (PyType_Type.tp_setattro) ((PyObject *) type, name.get (), desc); }