Include from sage.misc.cachefunc import ClearCacheOnPickle in the class hierarchy to disable pickling of caches. This has hurt us before in the toric varieties, see
http://trac.sagemath.org/ticket/15050 http://trac.sagemath.org/ticket/15149 http://trac.sagemath.org/ticket/15156 IMHO pickling really needs to exclude caches by default, otherwise we'll get more weird errors the more we use @cached_method. On Tuesday, November 19, 2013 9:54:10 AM UTC-5, mmarco wrote: > > I have writen some basic implementation of ideals for Laurent polynomial > rings (ticket #15437 ). It seems to work fine, but i don't know why, > pickling fails: > > sage: L=LaurentPolynomialRing(QQ,3,'t') > sage: loads(dumps(L)) > --------------------------------------------------------------------------- > AttributeError > Traceback (most recent call last) > <ipython-input-2-fe3c73a77523> in <module>() > ----> 1 loads(dumps(L)) > > > /mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/sage_object.so > in sage.structure.sage_object.loads (sage/structure/sage_object.c:11044) > () > > > /mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so > in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:8316)() > > > /mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so > in > sage.structure.parent.Parent.convert_map_from (sage/structure/parent.c:16121) > () > > > /mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so > in > sage.structure.parent.Parent.discover_convert_map_from > (sage/structure/parent.c:162 > 86)() > > > /mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so > in > sage.structure.parent.Parent.coerce_map_from (sage/structure/parent.c:14849) > () > > > /mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so > in sage.structure.parent._register_pair (sage/structure/parent.c:22017)() > > > /mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so > in sage.structure.parent.EltPair.__hash__ (sage/structure/parent.c:21664) > () > > > /mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/category_object.so > in > sage.structure.category_object.CategoryObject.__hash__ (sage/structure/cat > egory_object.c:8312)() > > > /mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/rings/polynomial/laurent_polynomial_ring.pyc > in __repr__(self) > 449 > 'Univariate Laurent Polynomial Ring in x over Rational Field' > 450 """ > --> 451 if self._n == 1: > 452 return > "Univariate Laurent Polynomial Ring in %s over %s"%(self._R.variable_name > (), self._R.base_ring()) > 453 else: > > > /mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so > in > sage.structure.parent.Parent.__getattr__ (sage/structure/parent.c:6736)() > > <type 'str'> > : (<type 'exceptions.AttributeError'>, > AttributeError('LaurentPolynomialRing_mpair_with_category' object has no > attribute '_n',)) > > > I added a few methods and atributes to the Laurent polynomial ring > classes, but didn't change the structure of the way they are constructed, > so i don't understand why, at unpickling, the ._n atribute disappears now. > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.
