From 0c5d88dd3b8e20560acc3cf3a449f2c7c75b2288 Mon Sep 17 00:00:00 2001 From: Antonio Rojas Date: Tue, 1 Oct 2024 19:00:00 +0200 Subject: [PATCH] Fix build with pari 2.17 NEXT_PRIME_VIADIFF is removed in 2.17, port pari_prime_range to pari_PRIMES instead --- src/sage/libs/pari/convert_sage.pyx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/sage/libs/pari/convert_sage.pyx b/src/sage/libs/pari/convert_sage.pyx index 64386bcf632..db6725f39a5 100644 --- a/src/sage/libs/pari/convert_sage.pyx +++ b/src/sage/libs/pari/convert_sage.pyx @@ -573,17 +573,16 @@ cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=False): sage: pari_prime_range(2, 19) [2, 3, 5, 7, 11, 13, 17] """ - cdef long p = 0 - cdef byteptr pari_prime_ptr = diffptr + cdef ulong i = 1 res = [] - while p < c_start: - NEXT_PRIME_VIADIFF(p, pari_prime_ptr) - while p < c_stop: + while pari_PRIMES[i] < c_start: + i+=1 + while pari_PRIMES[i] < c_stop: if py_ints: - res.append(p) + res.append(pari_PRIMES[i]) else: z = PY_NEW(Integer) - mpz_set_ui(z.value, p) + mpz_set_ui(z.value, pari_PRIMES[i]) res.append(z) - NEXT_PRIME_VIADIFF(p, pari_prime_ptr) + i+=1 return res