On Mar 28, 8:59 am, William Stein <wst...@gmail.com> wrote:
> I know of one place in sage where objects cache their hash for
> efficiency reasons (e.g., I think Sage matrices do). I hadn't thought
> about the fact that pickling, moving to an object to a platform where
> the hashes are different, and unpickling, would result in the subtle
> issue above, but that makes sense.   Here is an example:
>
> On a 32-bit platform do this:
>
> sage: a = matrix(ZZ,2,[1,-2,4,1993938292]); a.set_immutable(); b =
> {a:5}; save(b,'/Users/wstein/b.sobj')
>
> Then load b on a 64-bit platform (e.g. ,sage.math):
>
> sage: a = matrix(ZZ,2,[1,-2,4,1993938292]); a.set_immutable(); b =
> load('b.sobj'); b[a]
> boom! KeyError ...
> sage: sage: b.keys()[0] == a
> True
>
> The fix here is that right before pickling the cached hash of the
> matrix should be deleted.
>
> I don't know any other places in Sage that do the above.

This also happens (at least) in combinat/; see the __hash__
implementation in combinat/combinat.py

> This is now
>
>    http://trac.sagemath.org/sage_trac/ticket/5624

I've mentioned this on the ticket, as well.

Carl

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to