Opened 13 years ago

Closed 13 years ago

#4698 closed defect (fixed)

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

Reported by: burcin Owned by: burcin
Priority: major Milestone: sage-3.2.2
Component: algebra Keywords:
Cc: robertwb, was Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

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 (1)

trac_4698-pickle.patch (4.5 KB) - added by burcin 13 years ago.

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by burcin

comment:1 Changed 13 years ago 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.

comment:2 Changed 13 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from new to closed

Merged in Sage 3.2.2.alpha1

Note: See TracTickets for help on using tickets.