Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a single make_element function for pickling is hard to maintain #4698

Closed
burcin opened this issue Dec 4, 2008 · 2 comments
Closed

a single make_element function for pickling is hard to maintain #4698

burcin opened this issue Dec 4, 2008 · 2 comments

Comments

@burcin
Copy link
Contributor

burcin commented Dec 4, 2008

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

CC: @robertwb @williamstein

Component: algebra

Issue created by migration from https://trac.sagemath.org/ticket/4698

@burcin burcin added this to the sage-3.2.2 milestone Dec 4, 2008
@burcin burcin self-assigned this Dec 4, 2008
@williamstein
Copy link
Contributor

comment:1

Attachment: trac_4698-pickle.patch.gz

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.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Dec 7, 2008

comment:2

Merged in Sage 3.2.2.alpha1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants