We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0e2164e commit 4641801Copy full SHA for 4641801
src/sage/cpython/cython_metaclass.h
@@ -52,6 +52,15 @@ static CYTHON_INLINE int Sage_PyType_Ready(PyTypeObject* t)
52
if (r < 0)
53
return r;
54
55
+#if PY_VERSION_HEX >= 0x03050000
56
+ // Cython 3 sets Py_TPFLAGS_HEAPSIZE before calling PyType_Ready,
57
+ // and resets just after the call. We need to do the same, or it may
58
+ // end up with illegal memory accesses.
59
+ // See also:
60
+ // https://github.com/cython/cython/issues/3603
61
+ t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
62
+#endif
63
+
64
/* Set or get metaclass (the type of t) */
65
PyTypeObject* metaclass;
66
0 commit comments