Well I'm getting closer. When loads is called on a list containing 2 
(distinct) points the first loads does fine, the second point __setstate__ 
is called with just the dict instead of (parent,dict). If it is say, 2 
distinct functions with the same parent, it works correctly (both called 
with (parent,dict). I still haven't found the code that is calling 
__setstate__ in the first place to see why the parent is getting dropped.

So, I'm still hoping someone can save me a bunch of time searching by 
pointing to where the details are implemented.

On Wednesday, April 9, 2014 8:52:26 PM UTC-4, Ben Hutz wrote:
>
> I'm working on points and morphisms of projective space with #15780 and 
> I've come across an issue that is related to save/load. So, I've been 
> experimenting try to see what works and what doesn't and I've come to the 
> conclusion that I don't really know how it works. Here are two examples, 
> one of which works, one of which doesn't.
>
> If I try to save a list of projective points it failes. But if I make a 
> projective function the first entry (but not the 2nd or 3rd), then it 
> works. If there is only one point in the list it also works. Otherwise I 
> get an error like:
>
> Traceback (most recent call last):    f=H([x^2-y^2,y^2])
>   File "", line 1, in <module>
>     
>   File "/tmp/tmpdpkZt2/___code___.py", line 12, in <module>
>     exec compile(u'load(objfile_short)
>   File "", line 1, in <module>
>     
>   File "sage_object.pyx", line 862, in sage.structure.sage_object.load 
> (sage/structure/sage_object.c:9774)
>   File "sage_object.pyx", line 1236, in sage.structure.sage_object.loads 
> (sage/structure/sage_object.c:11522)
>   File "element.pyx", line 404, in 
> sage.structure.element.Element.__setstate__ (sage/structure/element.c:4342)
>   File "element.pyx", line 268, in 
> sage.structure.element.Element._set_parent (sage/structure/element.c:3664)
> TypeError: Cannot convert dict to sage.structure.parent.Parent
>
> here are the two examples
>
> {{{
> objfile = os.path.join(SAGE_TMP, 'test.sobj')
> objfile_short = os.path.join(SAGE_TMP, 'test')
> P.<x,y>=ProjectiveSpace(QQ,1)
> H=End(P)
> Q=P(1)
> R=P(2)
> f=H([x^2-y^2,y^2])
> r=[f,R,Q]
> save(r, objfile)
> load(objfile_short)
> }}}
>
> {{{
> objfile = os.path.join(SAGE_TMP, 'test.sobj')
> objfile_short = os.path.join(SAGE_TMP, 'test')
> P.<x,y>=ProjectiveSpace(QQ,1)
> H=End(P)
> Q=P(1)
> R=P(2)
> f=H([x^2-y^2,y^2])
> r=[Q,R]
> save(r, objfile)
> load(objfile_short)
> }}}
>
> If someone could explain to me why this is failing that would be very 
> helpful. Or even point me to where to look in the source to track this down.
>
> Thanks,
>   Ben
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to