Ticket #4698 (closed defect: fixed)

Opened 1 month ago

Last modified 1 month ago

[with patch, positive review] a single make_element function for pickling is hard to maintain

Reported by: burcin Assigned to: burcin
Priority: major Milestone: sage-3.2.2
Component: algebra Keywords:
Cc: robertwb, was

Description

All subclasses of sage.structure.element.Element end up using sage.structure.element.make_element for unpickling. This design is very hard to maintain, especially when trying to keep backward compatibility with older pickles.

Python's pickling protocol via __getstate__() and __setstate__() moves the implementation of pickling/unpickling to the subclasses. [1] Attached patch changes sage.structure.element.Element to use this protocol.

[1] http://www.python.org/doc/2.5/lib/pickle-inst.html

Attachments

trac_4698-pickle.patch (4.5 kB) - added by burcin on 12/04/2008 03:05:18 PM.

Change History

12/04/2008 03:05:18 PM changed by burcin

  • attachment trac_4698-pickle.patch added.

12/06/2008 02:28:38 PM changed by was

  • summary changed from [with patch, needs review] a single make_element function for pickling is hard to maintain to [with patch, positive review] a single make_element function for pickling is hard to maintain.

I fully doctested this on sage.math and it worked perfectly.

I read the code and it looks good, and like a nice solution. Bravo.

12/07/2008 12:07:15 AM changed by mabshoff

  • status changed from new to closed.
  • resolution set to fixed.

Merged in Sage 3.2.2.alpha1