I'd like to draw your attention to these two issues:
http://code.google.com/p/sympy/issues/detail?id=1176
http://code.google.com/p/sympy/issues/detail?id=1177
does anyone has any idea where the problem is?
If this works:
In [1]: import pickle
In [2]: pickle.loads(pickle.dumps(sin(4)))
Out[2]: sin(4)
and this fails:
In [3]: pickle.loads(pickle.dumps(sin(4), 2))
ERROR: An unexpected error occurred while tokenizing input
then it almost smells like some problem in python itself. Let's
investigate and if it's a python bug, report to python-dev.
This bug needs to be resolved so that we can use sympy with ipython
parallel stuff that uses protocol 2.
Thanks,
Ondrej
Protocol 2 invokes cls.__new__(cls, ()) on new-style classes if you
don't implement __getnewargs__() on your classes. Every time you make
a new class that requires arguments to __new__(), you need to
implement __getnewargs__() to return a tuple that can be passed into
your __new__().
I have a patch on sympy-patches that does this for all of the classes
tested by test_pickle. There may be other classes that don't work.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
Wow, that's great! Thanks for the work.
I don't see any patches in there:
http://groups.google.com/group/sympy-patches
maybe you forgot to join the group? Unfortunately we need to require
the membership due to spam.
Ondrej
I've joined, but I think my sendmail configuration may not be working.
git send-email finishes with OK, though. The patch is attached to the
issue.
Ah, I see, thanks. All patches are in, only it exposed one new bug:
http://code.google.com/p/sympy/issues/detail?id=1259
But I almost have a patch for it. I went to ride a bike here in Reno
and it's very cool, nice mountains, so I need to take a shower then
I'll finish the patch.
Ondrej