This is now #12038, which has a patch which eliminates the segfault. The problem was that you shouldn't be using coerce like that: the first argument should be a parent, not the element class. That element class requires two inputs: both the parent and the data to make a new element out of. In this case, the __init__ method was only getting one input (1+I) and thus raising a TypeError. There's now no reference to your new ComplexNumber, so it's deallocated, but the mpfrs are only initialized in the __init__ method, which was never called. So when you try to clear them in __dealloc__, you get a segfault. David
On Mon, Nov 14, 2011 at 23:38, Justin C. Walker <jus...@mac.com> wrote: > > On Nov 14, 2011, at 18:04 , Dan Drake wrote: > >> This is not fun: >> >> sage: from sage.rings.complex_number import ComplexNumber as CN >> sage: parent(1+I) >> Symbolic Ring >> sage: coerce(CN, 1+I) >> BOOM >> >> (with 4.8.alpha1 and 4.7.2 in 64-bit Linux) >> >> It looks like mpfr is extremely unhappy about something. >> >> Also, if I just use the regular ComplexNumber in the global namespace >> with the same command, I get "TypeError: unable to coerce to a >> ComplexNumber: <type 'str'>". I understand that coercion may not be able >> to handle SymbolicRing stuff to complex, but that's a strange message, >> especially since ComplexNumber claims that it wants strings to convert. >> But for now let's just deal with the segfault. > > I get segfaults for both cases ('CN' and 'ComplexNumber') all the way back to > 2.11 (I've tried most of the 4.x releases, some of the 3.x's and only one of > the 2's). I don't see the "TypeError" failure in any case. > > Justin > > -- > Justin C. Walker, Curmudgeon at Large > Institute for the Absorption of Federal Funds > -- > Democracy is two wolves and a lamb > voting on what to have for lunch. > Liberty is a well-armed lamb contesting > the vote. > > > > -- > To post to this group, send an email to sage-devel@googlegroups.com > To unsubscribe from this group, send an email to > sage-devel+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-devel > URL: http://www.sagemath.org > -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org