Skip to content

Commit 1a9ae6b

Browse files
jamesjervidelec
authored andcommitted
Python 3.10 compatibility
1 parent 01f37a9 commit 1a9ae6b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cypari2/convert.pyx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ cdef extern from *:
5959
ctypedef struct PyLongObject:
6060
digit* ob_digit
6161

62-
Py_ssize_t* Py_SIZE_PTR "&Py_SIZE"(object)
62+
void __Pyx_SET_SIZE(object, Py_ssize_t)
6363

6464

6565
########################################################################
@@ -450,13 +450,11 @@ cdef PyLong_FromINT(GEN g):
450450
if d:
451451
sizedigits_final = i+1
452452

453-
# Set correct size (use a pointer to hack around Cython's
454-
# non-support for lvalues).
455-
cdef Py_ssize_t* sizeptr = Py_SIZE_PTR(x)
453+
# Set correct size
456454
if signe(g) > 0:
457-
sizeptr[0] = sizedigits_final
455+
__Pyx_SET_SIZE(x, sizedigits_final)
458456
else:
459-
sizeptr[0] = -sizedigits_final
457+
__Pyx_SET_SIZE(x, -sizedigits_final)
460458

461459
return x
462460

0 commit comments

Comments
 (0)