I must admit that I do not know what that method call exactly does,
but calling it resolve the mentionned bug.
Moreover it is called in different places all over the file in a
similar manner so I have the feeling that it could be an acceptable
fix.
I'll open a trac ticket with that fix and a doctest hoping that
someone with a better understanding of ntl and gf2x will confirm that
it is ok or provide a correct fix.

Cheers,

On 27 mai, 15:22, Jean-Pierre Flori <jpfl...@gmail.com> wrote:
> Adding
>
>         (<FiniteField_ntl_gf2e>self._parent).F.restore()
> before calling
> cdef GF2X_c r = GF2X_IrredPolyMod(GF2E_rep(self.x),GF2E_modulus())
> fixes everything.
> Not sure yet why it does not get called before in that situation...
>
> On 27 mai, 15:03, Jean-Pierre Flori <jpfl...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Putting sig_on/sig_off around:
> >         sig_on()
> >         cdef GF2X_c r = GF2X_IrredPolyMod(GF2E_rep(self.x),
> > GF2E_modulus())
> >         sig_off()
> > I get:
> > /home/jp/boulot/sage/sage-4.7.rc1/local/lib/python2.6/site-packages/
> > sage/rings/finite_rings/element_ntl_gf2e.so in
> > sage.rings.finite_rings.element_ntl_gf2e.FiniteField_ntl_gf2eElement.minpoly
> > (sage/rings/finite_rings/element_ntl_gf2e.cpp:11156)()
>
> > RuntimeError: build GF2XArgument: bad args
>
> > What is also strange is that it only happens for the second element...
>
> > On 27 mai, 14:49, Simon King <simon.k...@uni-jena.de> wrote:
>
> > > Hi Jean-Pierre,
>
> > > On 27 Mai, 14:31, Jean-Pierre Flori <jpfl...@gmail.com> wrote:
>
> > > > I'll take care of it with a fix hopefully.
>
> > > It turns out that the error occurs in the list() method of a homset,
> > > which starts with
>
> > > sage: K = GF(1<<16,'a'); L = GF(1<<32,'b')
> > > sage: self = K.Hom(L)
> > > sage: D = self.domain()
> > > sage: C = self.codomain()
> > > sage: f = D.modulus()
> > > sage: g = C['x'](f)
> > > sage: r = g.roots()
>
> > > Now, the following works:
> > > sage: for a,_ in r:
> > > ....:     print a
> > > ....:     t = D.hom(a,C)
> > > ....:
>
> > > But this segfaults!!
> > > sage: for a,_ in r:
> > > ....:     t = D.hom(a,C)
> > > ....:
>
> > > In other words, printing the elements `a` seems to initialise some
> > > data, and without printing them data are missing, resulting in a
> > > segfault. Or put differently, the initialisation of finite field
> > > elements is incomplete.
>
> > > By the way, the elements `a` have a custom __repr__ method - shouldn't
> > > it be _repr_ with a single underscore?
>
> > > Cheers,
> > > Simon

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to