On Tuesday, January 21, 2014 1:47:47 PM UTC-8, Simon King wrote: > > I don't understand what is the problem with the Python class. Please > enlighten me! >
I don't either, but I'll share some of my observations from the traceback. The libsingular init calls as a first thing MPolynomialRing_generic.__init__ which ends up triggering: sage/categories/algebras.py:159 154 except AssertionError: 155 pass 156 return 157 158 try: > 159 one = self.one() which looks like trouble to me, since the libsingular code only later sets self._one_element = one, where `one` is an explicitly Is it perhaps some type issue (where it explicitly tests for libsingular rings to avoid doing something) or the existence of a self.__dict__ that makes categories/algebras try to get the one element? In this order, you'll trigger the generic "x=self(1)" implementation of `one` which will wreak havoc: the underlying libsingular ring isn't even instantiated yet! You might be able to make the code more robust by seeing if you can rearrange MPolynomial_libsingular.__init__ to only call the generic __init__ once the libsingular-specific attributes have been filled in. It may seem weird, but as you can see, apparently a part of the category-based initialization stuff expects to be passed fully functional rings during initialization, so that suggests tail calls in the __init__ hierarchy rather than head calls. It would be good to identify why this isn't giving problems on a cdef class. The code that triggers the problem sits in sage.categories.algebras.Algebras.ParentMethods.__init_extra__ so the ease with which you can track down the problem will be a good test for how viable the category dynamic class stuff is in practice. -- 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/groups/opt_out.