Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 822513d

Browse files
author
Jean-Pierre Flori
committed
Fix tests for latest Sage dev version.
1 parent a62af73 commit 822513d

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

src/sage/rings/finite_rings/element_flint_fq.pyx

+10-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ AUTHORS:
1919
include "sage/ext/interrupt.pxi"
2020
include "sage/ext/stdsage.pxi"
2121
include "sage/libs/pari/decl.pxi"
22-
include "sage/libs/pari/pari_err.pxi"
2322

2423
from sage.libs.gmp.all cimport *
2524
from sage.libs.flint.types cimport *
@@ -183,13 +182,13 @@ cdef class FiniteFieldElement_flint_fq(FinitePolyExtElement):
183182
elif isinstance(x, pari_gen):
184183
x_GEN = (<pari_gen>x).g
185184

186-
pari_catch_sig_on()
185+
sig_on()
187186
if gequal0(x_GEN):
188187
fq_zero(self.val, self._cparent)
189-
pari_catch_sig_off()
188+
sig_off()
190189
elif gequal1(x_GEN):
191190
fq_one(self.val, self._cparent)
192-
pari_catch_sig_off()
191+
sig_off()
193192
else:
194193
t = typ(x_GEN)
195194
p = self._parent.characteristic()
@@ -198,18 +197,18 @@ cdef class FiniteFieldElement_flint_fq(FinitePolyExtElement):
198197
if t == t_FFELT:
199198
# The following calls pari_catch_sig_off()
200199
x = (<PariInstance>pari).new_gen(FF_p(x_GEN))
201-
pari_catch_sig_on()
200+
sig_on()
202201
y = FF_f(x_GEN)
203202
R = modulus.parent()
204-
pari_catch_sig_on()
203+
sig_on()
205204
z = R((<PariInstance>pari).new_gen(FF_mod(x_GEN)))
206205
if x == p and y == f and z == modulus:
207206
# The following calls pari_catch_sig_off()
208207
x = (<PariInstance>pari).new_gen(FF_to_FpXQ(x_GEN))
209208
self.construct_from(R(x))
210209
return
211210
elif t == t_INT:
212-
pari_catch_sig_off()
211+
sig_off()
213212
self.construct_from(Integer(x))
214213
return
215214
elif t == t_INTMOD:
@@ -225,7 +224,7 @@ cdef class FiniteFieldElement_flint_fq(FinitePolyExtElement):
225224
self.construct_from(Rational(x))
226225
return
227226
else:
228-
pari_catch_sig_off()
227+
sig_off()
229228
raise TypeError("no coercion defined")
230229

231230
elif (isinstance(x, FreeModuleElement)
@@ -585,7 +584,7 @@ cdef class FiniteFieldElement_flint_fq(FinitePolyExtElement):
585584
cdef fmpz_t exp_fmpz
586585
inv = 0
587586
if exp == 0:
588-
return self._parent.one_element()
587+
return self._parent.one()
589588
if exp < 0:
590589
if fq_is_zero(self.val, self._cparent):
591590
raise ZeroDivisionError
@@ -885,9 +884,9 @@ cdef class FiniteFieldElement_flint_fq(FinitePolyExtElement):
885884
886885
sage: k.<a> = GF(3^17, impl='flint_fq')
887886
sage: a._pari_init_()
888-
'subst(a+3*a,a,ffgen(Mod(1, 3)*x^17 + Mod(2, 3)*x + Mod(1, 3),a))'
887+
'subst(a+3*a,a,ffgen(Mod(1, 3)*a^17 + Mod(2, 3)*a + Mod(1, 3),a))'
889888
sage: k(1)._pari_init_()
890-
'subst(1+3*a,a,ffgen(Mod(1, 3)*x^17 + Mod(2, 3)*x + Mod(1, 3),a))'
889+
'subst(1+3*a,a,ffgen(Mod(1, 3)*a^17 + Mod(2, 3)*a + Mod(1, 3),a))'
891890
892891
This is used for conversion to GP. The element is displayed
893892
as "a" but has correct arithmetic::

src/sage/rings/finite_rings/element_flint_fq_nmod.pyx

+10-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ AUTHORS:
1919
include "sage/ext/interrupt.pxi"
2020
include "sage/ext/stdsage.pxi"
2121
include "sage/libs/pari/decl.pxi"
22-
include "sage/libs/pari/pari_err.pxi"
2322

2423
from sage.libs.gmp.all cimport *
2524
from sage.libs.flint.types cimport *
@@ -182,13 +181,13 @@ cdef class FiniteFieldElement_flint_fq_nmod(FinitePolyExtElement):
182181
elif isinstance(x, pari_gen):
183182
x_GEN = (<pari_gen>x).g
184183

185-
pari_catch_sig_on()
184+
sig_on()
186185
if gequal0(x_GEN):
187186
fq_nmod_zero(self.val, self._cparent)
188-
pari_catch_sig_off()
187+
sig_off()
189188
elif gequal1(x_GEN):
190189
fq_nmod_one(self.val, self._cparent)
191-
pari_catch_sig_off()
190+
sig_off()
192191
else:
193192
t = typ(x_GEN)
194193
p = self._parent.characteristic()
@@ -197,18 +196,18 @@ cdef class FiniteFieldElement_flint_fq_nmod(FinitePolyExtElement):
197196
if t == t_FFELT:
198197
# The following calls pari_catch_sig_off()
199198
x = (<PariInstance>pari).new_gen(FF_p(x_GEN))
200-
pari_catch_sig_on()
199+
sig_on()
201200
y = FF_f(x_GEN)
202201
R = modulus.parent()
203-
pari_catch_sig_on()
202+
sig_on()
204203
z = R((<PariInstance>pari).new_gen(FF_mod(x_GEN)))
205204
if x == p and y == f and z == modulus:
206205
# The following calls pari_catch_sig_off()
207206
x = (<PariInstance>pari).new_gen(FF_to_FpXQ(x_GEN))
208207
self.construct_from(R(x))
209208
return
210209
elif t == t_INT:
211-
pari_catch_sig_off()
210+
sig_off()
212211
self.construct_from(Integer(x))
213212
return
214213
elif t == t_INTMOD:
@@ -224,7 +223,7 @@ cdef class FiniteFieldElement_flint_fq_nmod(FinitePolyExtElement):
224223
self.construct_from(Rational(x))
225224
return
226225
else:
227-
pari_catch_sig_off()
226+
sig_off()
228227
raise TypeError("no coercion defined")
229228

230229
elif (isinstance(x, FreeModuleElement)
@@ -582,7 +581,7 @@ cdef class FiniteFieldElement_flint_fq_nmod(FinitePolyExtElement):
582581
cdef fmpz_t exp_fmpz
583582
inv = 0
584583
if exp == 0:
585-
return self._parent.one_element()
584+
return self._parent.one()
586585
if exp < 0:
587586
if fq_nmod_is_zero(self.val, self._cparent):
588587
raise ZeroDivisionError
@@ -866,9 +865,9 @@ cdef class FiniteFieldElement_flint_fq_nmod(FinitePolyExtElement):
866865
867866
sage: k.<a> = GF(3^17, impl='flint_fq_nmod')
868867
sage: a._pari_init_()
869-
'subst(a+3*a,a,ffgen(Mod(1, 3)*x^17 + Mod(2, 3)*x + Mod(1, 3),a))'
868+
'subst(a+3*a,a,ffgen(Mod(1, 3)*a^17 + Mod(2, 3)*a + Mod(1, 3),a))'
870869
sage: k(1)._pari_init_()
871-
'subst(1+3*a,a,ffgen(Mod(1, 3)*x^17 + Mod(2, 3)*x + Mod(1, 3),a))'
870+
'subst(1+3*a,a,ffgen(Mod(1, 3)*a^17 + Mod(2, 3)*a + Mod(1, 3),a))'
872871
873872
This is used for conversion to GP. The element is displayed
874873
as "a" but has correct arithmetic::

0 commit comments

Comments
 (0)