Opened 7 years ago
Closed 7 years ago
#13998 closed defect (fixed)
hash of a pickled Sequence is broken
Reported by: | slabbe | Owned by: | slabbe |
---|---|---|---|
Priority: | major | Milestone: | sage-5.7 |
Component: | pickling | Keywords: | |
Cc: | Merged in: | sage-5.7.beta2 | |
Authors: | Sébastien Labbé | Reviewers: | Stephan Ehlen |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
The following works::
sage: M = ModularSymbols(1,12,sign=1) sage: M Modular Symbols space of dimension 2 for Gamma_0(1) of weight 12 with sign 1 over Rational Field sage: S = M.cuspidal_submodule().decomposition()[0].free_module().basis() sage: type(S) <class 'sage.structure.sequence.Sequence_generic'> sage: S [ (1, 0) ] sage: hash(S) 979268961
But if you do the same from a certain pickled object, it is broken (tested on sage-4.7 and sage-5.6.rc0)::
sage: M = load('http://sage.math.washington.edu/home/slabbe/LMFDB/mstest.sobj') Attempting to load remote file: http://sage.math.washington.edu/home/slabbe/LMFDB/mstest.sobj Loading: [.] sage: M Modular Symbols space of dimension 2 for Gamma_0(1) of weight 12 with sign 1 over Rational Field sage: S = M.cuspidal_submodule().decomposition()[0].free_module().basis() sage: type(S) <class 'sage.structure.sequence.Sequence_generic'> sage: S [ (1, 0) ] sage: hash(S) Traceback (most recent call last) ... AttributeError: 'Sequence_generic' object has no attribute '_Sequence_generic__hash'
This particular problem was reported by LMFDB developper who understands that Sage do not guarrenty that pickled object are supported by later version of Sage. Let's fix this problem !!!
Attachments (1)
Change History (8)
comment:1 Changed 7 years ago by
Changed 7 years ago by
comment:2 Changed 7 years ago by
- Status changed from new to needs_review
comment:3 Changed 7 years ago by
- Description modified (diff)
comment:4 Changed 7 years ago by
- Status changed from needs_review to positive_review
I tested the patch with sage version 5.5. I tested that:
- The described bug does not occur anymore with the pickled object (see also my remark below).
- The buggy behaviour described in comment 1 is now fixed.
- The patch adds doctests for the patch with reference to the trac ticket.
- The doctests complete without any errors.
- The sage documentation builds fine.
Remark: In fact, the pickled object was provided by me and belongs to a large collection that serves the LMFDB (www.lmfdb.org) website currently. This means that the bug affected >13000 pickled objects. Now the first example from above works with the objects taken from the database (I tested a few, not all of them.)
comment:5 Changed 7 years ago by
Please fill in the Author / Reviewer fields.
comment:6 Changed 7 years ago by
- Reviewers set to Stephan Ehlen
comment:7 Changed 7 years ago by
- Merged in set to sage-5.7.beta2
- Resolution set to fixed
- Status changed from positive_review to closed
Here is a way to reproduce the problem on a recent version of Sage:
This is what I am going to use to doctest the fix.