Open antonio-rojas opened 3 days ago
there are doctest failures like this.
https://github.com/sagemath/cypari2/actions/runs/11186104097/job/31100414929#step:5:322
in cypari2.pari_instance.__test__.default_bitprec (line 367)
Failed example:
default_bitprec()
Differences (ndiff with -expected +actual):
- 64
+ 3
it's probably hard to avoid differentiating between pari versions up to 2.15 and 2.17+ in this test.
it's probably hard to avoid differentiating between pari versions up to 2.15 and 2.17+ in this test.
That was actally an issue with my code, this test should always return 64.
Tests seem fine now. However, I'm seeing a weird issue that I don't understand. With this patch, in sage I get
sage: N = 1715761513; E = EllipticCurve(Integers(N), [3,-13]); P = E(2,1); LCM([2..60])*P
[...]
PariError: impossible inverse in Fp_inv: Mod(26927, 1715761513)
which shows that the PariError
is not being intercepted in https://github.com/sagemath/sage/blob/10.5.beta6/src/sage/schemes/elliptic_curves/ell_point.py#L3915. If I change except PariError
to except Exception
it works, and querying the exception type shows that it is indeed a PariError
.
The issue doesn't happen without this patch (but of course lots of precision related stuff is broken). Any idea what's going on here? Why should these changes affect PariError
handling?
Tests seem fine now. However, I'm seeing a weird issue that I don't understand. With this patch, in sage I get
sage: N = 1715761513; E = EllipticCurve(Integers(N), [3,-13]); P = E(2,1); LCM([2..60])*P [...] PariError: impossible inverse in Fp_inv: Mod(26927, 1715761513)
which shows that the
PariError
is not being intercepted in https://github.com/sagemath/sage/blob/10.5.beta6/src/sage/schemes/elliptic_curves/ell_point.py#L3915. If I changeexcept PariError
toexcept Exception
it works, and querying the exception type shows that it is indeed aPariError
.The issue doesn't happen without this patch (but of course lots of precision related stuff is broken). Any idea what's going on here? Why should these changes affect
PariError
handling?
Could it be a PariError
from an other cypari2 (sounds super weird)? Did you check in the catch whether PariError == PariError
?
Ah, found the issue. sage/schemes/elliptic_curves/ell_point.py
has
try:
from sage.libs.pari.all import pari, PariError
from cypari2.pari_instance import prec_words_to_bits
except ImportError:
PariError = ()
which of course fails to properly import PariError
after prec_words_to_bits
removal.
Since 2.17 pari stores the precision in bits instead of words. Port cypari2 to work with it:
prec_bits_to_words
toprec_bits_to_pari
and outsource it to upstream's nbits2prec, so it works with all pari versionsprec_words_to_bits
,prec_dec_to_words
andprec_words_to_dec
functionsLOWDEFAULTPREC
as default precision