--- a/src/sage/cpython/cython_metaclass.h +++ b/src/sage/cpython/cython_metaclass.h @@ -66,7 +66,7 @@ } /* Now, set t.__class__ to metaclass */ - Py_TYPE(t) = metaclass; + Py_SET_TYPE(t, metaclass); PyType_Modified(t); } else --- a/src/sage/symbolic/ginac/numeric.cpp +++ b/src/sage/symbolic/ginac/numeric.cpp @@ -52,7 +52,6 @@ #define register #define PY_SSIZE_T_CLEAN #include -#include #include "flint/fmpz.h" #include "flint/fmpz_factor.h" --- a/src/sage/libs/gmp/pylong.pyx +++ b/src/sage/libs/gmp/pylong.pyx @@ -32,7 +32,7 @@ from .mpz cimport * cdef extern from *: - Py_ssize_t* Py_SIZE_PTR "&Py_SIZE"(object) + void Py_SET_SIZE(object, Py_ssize_t) int hash_bits """ #ifdef _PyHASH_BITS _PyHASH_BITS /* Python 3 */ @@ -57,10 +57,8 @@ mpz_export(L.ob_digit, NULL, -1, sizeof(digit), 0, PyLong_nails, z) if mpz_sgn(z) < 0: - # Set correct size (use a pointer to hack around Cython's - # non-support for lvalues). - sizeptr = Py_SIZE_PTR(L) - sizeptr[0] = -pylong_size + # Set correct size + Py_SET_SIZE(L, -pylong_size) return L