On Tue, Jun 7, 2011 at 12:25 PM, Gonzalo Tornaria
<torna...@math.utexas.edu> wrote:
> In sage/structure/parent_base.pyx there is a function
> "check_old_coerce" with the following definition:
>
> cdef inline check_old_coerce(parent.Parent p):
>    if p._element_constructor is not None:
>        raise RuntimeError, "%s still using old coercion framework" % p
>
>
> This function is called from a few methods in class ParentWithBase
> (e.g. from _richcmp, from _coerce_c_impl, and from base_extend).
>
> In my class (which inherits from ParentWithBase) I've defined
> _element_constructor_ instead, but the init for ParentWithBase insist
> on copying this method onto _element_constructor -- thus the
> "check_old_coerce" function always fails... It's impossible to
> avoid!!!
>
> What is the base class that one is supposed to use instead of ParentWithBase?

Just Parent, if one can.

> The only reference for the coercion model that I was able to find is
> http://www.sagemath.org/doc/reference/coercion.html#example, which
> even shows an example, but the example inherits from Ring, which
> ultimately inherits from ParentWithBase anyway.

What this is really telling you is that you're using an old coercon
method from a class that's trying to do new-style coercion. (I was
hoping to have all this ripped out years ago, but it lingers on...)

In particular, _coerce_c_impl should never be called, nor should
_richcmp or the generic base_extend. A full traceback would help see
what the problem is.

- Robert

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

Reply via email to