@@ -491,7 +491,8 @@ cdef class Pari(Pari_auto):
491491
492492 # Take 1MB as minimal stack. Use maxprime=0, which PARI will
493493 # internally increase to some small value like 65537.
494- pari_init_opts(1000000 , 0 , INIT_DFTm)
494+ # (see function initprimes in src/language/forprime.c)
495+ pari_init_opts(1000000 * sizeof(long ), 0 , INIT_DFTm)
495496 after_resize()
496497
497498 # Disable PARI's stack overflow checking which is incompatible
@@ -557,7 +558,7 @@ cdef class Pari(Pari_auto):
557558
558559 When the PARI system is already initialized, the PARI stack is only
559560 grown if ``size`` is greater than the current stack, and the table
560- of primes is only computed is ``maxprime`` is larger than the current
561+ of primes is only computed if ``maxprime`` is larger than the current
561562 bound.
562563
563564 Examples:
@@ -575,6 +576,11 @@ cdef class Pari(Pari_auto):
575576 >>> pari.stacksize(), pari2.stacksize()
576577 (10000000, 10000000)
577578
579+ >>> Pari().default("primelimit")
580+ 500000
581+ >>> Pari(maxprime=20000).default("primelimit")
582+ 20000
583+
578584 For more information about how precision works in the PARI
579585 interface, see :mod:`cypari2.pari_instance`.
580586
@@ -603,6 +609,7 @@ cdef class Pari(Pari_auto):
603609 set_pari_stack_size(size, sizemax)
604610
605611 # Increase the table of primes if needed
612+ GP_DATA.primelimit = maxprime
606613 self .init_primes(maxprime)
607614
608615 # Initialize some constants
@@ -1042,15 +1049,15 @@ cdef class Pari(Pari_auto):
10421049 >>> pari = cypari2.Pari()
10431050 >>> pari.init_primes(200000)
10441051
1045- We make sure that ticket :trac:`11741` has been fixed::
1052+ We make sure that ticket :trac:`11741` has been fixed:
10461053
1047- >>> pari.init_primes(2**30)
1048- Traceback (most recent call last):
1049- ...
1050- ValueError: Cannot compute primes beyond 436273290
1054+ >>> pari.init_primes(2**30)
1055+ Traceback (most recent call last):
1056+ ...
1057+ ValueError: Cannot compute primes beyond 436273290
10511058 """
1052- # Hardcoded bound in PARI sources
1053- if M > 436273290 :
1059+ # Hardcoded bound in PARI sources (language/forprime.c)
1060+ if M > 436273289 :
10541061 raise ValueError (" Cannot compute primes beyond 436273290" )
10551062
10561063 if M <= maxprime():
0 commit comments