Patch is now up at: http://trac.sagemath.org/sage_trac/ticket/6462
David On Jul 4, 2:14 pm, davidloeffler <[email protected]> wrote: > It is indeed a bit strange that OrderElement derives from > FieldElement. But my diagnosis was different: Parent classes that have > attributes which are Elements cause problems for the default Python > unpickler. > > For instance, if X is an AbsoluteOrder, then loads(dumps(X)) works and > equals X, *as long as you don't do anything with X first*. If you do > anything with X, then X._AbsoluteOrder__basis will be set to a list of > elements of X; and then X becomes unpickleable. > > The reason I had trouble getting to the bottom of it at first was that > the tracebacks were all mangled. The reason for this is subtle: some > of the error reporting code was trying to call _repr_ on an > AbsoluteOrder object that was only half-unpickled and hence missing > some attributes, which meant that _repr_ was itself raising an > exception. Hence the error was reported with the error message for the > second exception, but with the line numbers for the first! > > David > > On Jul 4, 12:46 pm, William Stein <[email protected]> wrote: > > > On Sat, Jul 4, 2009 at 1:25 PM, davidloeffler<[email protected]> > > wrote: > > > > This is now #6462. > > > > (I have played with it a bit myself, and I can get pickling and > > > unpickling to work, by defining a __reduce__ function for orders, and > > > adjusting the __reduce__ function for number field elements; but now > > > the standard x == loads(dumps(x)) test doesn't seem to work.) > > > I think the problem stems from the weird design of order elements. > > They are really quadratic number field elements, but they have their > > parents "brutally" changed to be an order instead. Since this design > > was Robert Bradshaw's clever idea, if he has time, perhaps he will be > > able to make a comment. > > > -- William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
