Ticket #10460 (closed defect: fixed)
Pickling of Functors
| Reported by: | SimonKing | Owned by: | nthiery |
|---|---|---|---|
| Priority: | major | Milestone: | sage-4.7 |
| Component: | categories | Keywords: | pickling, functors |
| Cc: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | Martin Raum |
| Authors: | Simon King | Merged in: | sage-4.7.alpha2 |
| Dependencies: | Stopgaps: |
Description
We used to have:
sage: F = QQ['t'].construction()[0] sage: G = loads(dumps(F)) sage: G == F True sage: G.domain() == F.domain() False sage: G.codomain() is None True
In other words, the cdef'd attributes of the construction functor are lost.
I created a generic pickling method for functors, so that it works a lot better:
sage: F = QQ['t'].construction()[0] sage: G = loads(dumps(F)) sage: G == F True sage: G.domain() == F.domain() True sage: G.codomain() is None False
The patch contains two tests, showing that the problem is solved.
Attachments
Change History
comment:3 Changed 2 years ago by SimonKing
I don't know why the patchbot complains. The patch applies cleanly to a fresh sage-4.6.2.alpha4.
Changed 2 years ago by SimonKing
-
attachment
10460_pickling_functors.patch
added
Pickling of functors. Independent of #8800
comment:4 Changed 2 years ago by SimonKing
Since the patchbot did not try to apply the patch again and since the patch cleanly applies to sage-4.6.1.alpha4, I now try to trigger another attempt of the patchbot by posting a new copy of the patch.
And, by the way, this rather simple patch still needs review...
comment:5 follow-up: ↓ 6 Changed 2 years ago by mraum
- Status changed from needs_review to positive_review
- Reviewers set to Martin Raum
- Milestone changed from sage-4.7 to sage-4.6.2
I only corrected tiny typos in the documentation, and I altered one doctest to better reflect the change that you introduced.
Changed 2 years ago by mraum
-
attachment
trac-10460-pickling_functors-review.patch
added
Replacement for original patch.
comment:6 in reply to: ↑ 5 Changed 2 years ago by SimonKing
Replying to mraum:
I only corrected tiny typos in the documentation, and I altered one doctest to better reflect the change that you introduced.
Thank you, Martin!
For the record, the patchbot and the release manager:
Apply trac-10460-pickling_functors-review.patch

To the patchbot / release manager:
Depends on #8800
So, in fact, it also depends on #8807 and #10318.
Up to now, I only tested sage/categories/functor.pyx and sage/categories/pushout.py. However, since they use functors intensely, I am already marking the ticket as "needs review".