# HG changeset patch
# User Johan Bosman <johan.g.bosman@gmail.com>
# Date 1313238271 3600
# Node ID 5c5f0c29b1595babf75f7b9890ce5abdfe0ac426
# Parent deec96694006a4a64290153462f827f44b3bcd57
Trac 11685: Pari finite fields: zero created by list
diff r deec96694006 r 5c5f0c29b159 sage/rings/finite_rings/element_ext_pari.py
a

b


105  105  sage: pari(x) 
106  106  Mod(Mod(1, 3)*a^3 + Mod(2, 3)*a^2 + Mod(1, 3), Mod(1, 3)*a^11 + Mod(2, 3)*a^2 + Mod(1, 3)) 
107  107  
 108  As well as #11685:: 
 109  
 110  sage: K.<a> = GF(3^11) 
 111  sage: K([0]) 
 112  0 
 113  sage: K([0]) == 0 
 114  True 
 115  
108  116  If the list is longer than the degree, we just get the result 
109  117  modulo the modulus:: 
110  118  
… 
… 

162  170  # multiply it with _pari_one (which equals Mod(1,p)) to 
163  171  # fix the characteristic and then mod out by the modulus. 
164  172  # See #10486. 
165   self.__value = (pari(value).Polrev("a") * parent._pari_one()).Mod(parent._pari_modulus()) 
 173  value = pari(value) 
 174  if value: 
 175  value = value.Polrev("a") 
 176  else: 
 177  value = pari(0) 
 178  self.__value = (value * parent._pari_one()).Mod(parent._pari_modulus()) 
166  179  else: 
167  180  try: 
168  181  self.__value = pari(value).Mod(parent._pari_modulus())*parent._pari_one() 