Skip to content

Commit 0c5d88d

Browse files
committed
Fix build with pari 2.17
NEXT_PRIME_VIADIFF is removed in 2.17, port pari_prime_range to pari_PRIMES instead
1 parent d1f99d1 commit 0c5d88d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/sage/libs/pari/convert_sage.pyx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -573,17 +573,16 @@ cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=False):
573573
sage: pari_prime_range(2, 19)
574574
[2, 3, 5, 7, 11, 13, 17]
575575
"""
576-
cdef long p = 0
577-
cdef byteptr pari_prime_ptr = diffptr
576+
cdef ulong i = 1
578577
res = []
579-
while p < c_start:
580-
NEXT_PRIME_VIADIFF(p, pari_prime_ptr)
581-
while p < c_stop:
578+
while pari_PRIMES[i] < c_start:
579+
i+=1
580+
while pari_PRIMES[i] < c_stop:
582581
if py_ints:
583-
res.append(p)
582+
res.append(pari_PRIMES[i])
584583
else:
585584
z = <Integer>PY_NEW(Integer)
586-
mpz_set_ui(z.value, p)
585+
mpz_set_ui(z.value, pari_PRIMES[i])
587586
res.append(z)
588-
NEXT_PRIME_VIADIFF(p, pari_prime_ptr)
587+
i+=1
589588
return res

0 commit comments

Comments
 (0)