-
-
Notifications
You must be signed in to change notification settings - Fork 564
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
cPickle: adds support for class pickling customization #5985
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:6
I just rebased the first patch upon 3.4.2 final. Please ignore (or better delete) the old version cPickle-5985-import.patch |
comment:7
Note: the cPickle imports in dsage will need to be updated as well. |
comment:8
Updated patch:
|
comment:10
This patch needs an explicit addition of sage/misc/cPickle.c to MANIFEST.in for -sdist to work. It is also listed to have a positive review in the CategoriesRoadMap, but it isn't on the ticket. Cheers, Michael |
comment:11
Followup at #5986 |
Attachment: cPickle-5985-import-submitted.patch.gz |
comment:12
Replying to @sagetrac-mabshoff:
The updated patch hopefully fixes this (please double check).
Oops, fixed. Someone was supposed to give a positive review, but apparently this has not occurred yet. |
comment:13
I've rolled an spkg with the patch by Nicolas incorporated -- it's here: http://sage.math.washington.edu/home/craigcitro/four-one/python-2.6.2.p2.spkg It's not ready to be merged (I need to commit the changes in hg), but I'd like Nicolas to confirm that it still works before I play with it too much. Or, if there's an easy testcase, post that and I'll play with it. I should have more time to look at this tonight (and give it a review, assuming it works). |
comment:14
Replying to @craigcitro:
Thanks for working on this! The patch cPickle-5985-copy_reg_classes-submitted.patch includes a fairly complete testsuite (see the addition to sage/misc/test_cpickle_sage.py) |
comment:15
Attachment: cPickle-5985-copy_reg_classes-submitted.patch.gz Replying to @nthiery:
Oops, this testsuite used type.new(...) which apparently does not work anymore with Python 2.6. I just rewrote the testsuite so that it does not use this feature anymore. See attached patch. Luckily enough, the real applications of this patch readily did not use this feature anymore! |
comment:16
Replying to @nthiery:
For the record: zephyr-/opt/sage-4.0.2>./sage | Sage Version 4.0.2, Release Date: 2009-06-18 | Loading Sage library. Current Mercurial branch is: combinat zephyr-~>sage | Sage Version 4.1, Release Date: 2009-07-09 | Loading Sage library. Current Mercurial branch is: combinat Traceback (most recent call last): Apparently type.new now calls type.init. And I assume that can only be a change in python, not in Sage. |
comment:17
I'm uploading a new python spkg, which is the same as the previous one I posted, but based on the most recent python spkg in Sage. It's here: http://sage.math.washington.edu/home/craigcitro/python-2.6.2.p4.spkg This fixes the issue by patching the files in our python spkg instead of importing and using our own copy of |
comment:18
Replying to @craigcitro:
Sounds good to me! Positive review, up to someone double checking the new patch I attached which imports the test file from the original version of the patch. Carl, Craig, Robert, please do it soon! William is ok integrating this in 4.1.2 (see IRC). For the author / reviewer, I don't know exactly what to do since I wrote the first version, Craig reviewed it, wrote the second version which I reviewed :-) Please set whatever you feel appropriate |
This comment has been minimized.
This comment has been minimized.
Reviewer: Craig Citro, Nicolas M. Thiéry |
Author: Craig Citro, Nicolas M. Thiéry |
comment:19
I'm happy with Nicolas's patch to test the new python spkg -- let's finally get this merged! Yay! |
Attachment: trac_5985_test_class_pickling.patch.gz Apply only this patch, after updating the python spkg linked to below |
Merged: sage-4.2.alpha0 |
comment:20
I updated the patch to do "import cPickle" instead of importing it from sage.misc. After that, everything passes. |
Original implementation:
The first patch imports the vanilla cPickle.c and test_cpickle.py
from python 2.5.2.p9 as sage.misc.cPickle, and updates accordingly the
cPickle imports throughout the sage library.
The second patch makes a very small modification to cPickle to allow
for customizing how class are pickled via metaclasses.
Final implementation: adds the second patch to the python spkg
See discussions on:
Thanks to Mike, Burcin, and Carl for suggestions on how to handle this.
CC: @sagetrac-sage-combinat @sagetrac-cwitty @saliola @burcin @craigcitro
Component: misc
Keywords: cPickle, pickling classes
Author: Craig Citro, Nicolas M. Thiéry
Reviewer: Craig Citro, Nicolas M. Thiéry
Merged: sage-4.2.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/5985
The text was updated successfully, but these errors were encountered: