1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
index b8cc019..c7a1d8e 100644
--- a/src/sage/arith/long.pxd
+++ b/src/sage/arith/long.pxd
@@ -19,7 +19,7 @@ from cpython.object cimport Py_SIZE
from cpython.int cimport PyInt_AS_LONG
from cpython.long cimport PyLong_AsLong
from cpython.number cimport PyNumber_Index, PyIndex_Check
-from cpython.longintrepr cimport PyLongObject, PyLong_SHIFT, digit
+from cpython.longintrepr cimport py_long, PyLong_SHIFT, digit
from sage.libs.gmp.mpz cimport mpz_fits_slong_p, mpz_get_si
from sage.rings.integer_fake cimport is_Integer, Integer_AS_MPZ
@@ -208,7 +208,7 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
return 0
# x is a Python "long" (called "int" on Python 3)
- cdef const digit* D = (<PyLongObject*>x).ob_digit
+ cdef const digit* D = (<py_long>x).ob_digit
cdef Py_ssize_t size = Py_SIZE(x)
# We assume that PyLong_SHIFT is 15 on a 32-bit system and 30 on a
diff --git a/src/sage/libs/gmp/pylong.pyx b/src/sage/libs/gmp/pylong.pyx
index 168e485..9c214f6 100644
--- a/src/sage/libs/gmp/pylong.pyx
+++ b/src/sage/libs/gmp/pylong.pyx
@@ -28,7 +28,7 @@ AUTHORS:
from cpython.object cimport Py_SIZE
from cpython.int cimport PyInt_FromLong
from cpython.long cimport PyLong_FromLong
-from cpython.longintrepr cimport _PyLong_New, PyLongObject, digit, PyLong_SHIFT
+from cpython.longintrepr cimport _PyLong_New, py_long, digit, PyLong_SHIFT
from .mpz cimport *
cdef extern from *:
@@ -54,7 +54,7 @@ cdef mpz_get_pylong_large(mpz_srcptr z):
cdef size_t nbits = mpz_sizeinbase(z, 2)
cdef size_t pylong_size = (nbits + PyLong_SHIFT - 1) // PyLong_SHIFT
L = _PyLong_New(pylong_size)
- mpz_export((<PyLongObject*>L).ob_digit, NULL,
+ 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
@@ -91,7 +91,7 @@ cdef int mpz_set_pylong(mpz_ptr z, L) except -1:
if pylong_size < 0:
pylong_size = -pylong_size
mpz_import(z, pylong_size, -1, sizeof(digit), 0, PyLong_nails,
- (<PyLongObject*>L).ob_digit)
+ (<py_long>L).ob_digit)
if Py_SIZE(L) < 0:
mpz_neg(z, z)
diff --git a/src/setup.py b/src/setup.py
index 6a89cf8..bc8fe12 100755
--- a/src/setup.py
+++ b/src/setup.py
@@ -284,6 +284,7 @@ class sage_build_cython(Command):
cdivision=True,
embedsignature=True,
fast_getattr=True,
+ language_level="2",
preliminary_late_includes_cy28=True,
profile=self.profile,
)
|