[ZODB-Dev] Bug with ExtensionClass and __coerce__

Christian Reis kiko at async.com.br
Sat Jun 28 15:53:46 EDT 2003


In the next chapter of the war for Persistent.__cmp__, I found a bug in
ExtensionClass's handling of __coerce__. Here's a paired-down testcase.

    from ExtensionClass import Base

    class Foo(Base):
        def __coerce__(self, other): return None

    class Bar(Base):
        def __coerce__(self, other): return NotImplemented

    f = Foo(); assert 0 < f

        -> SystemError: error return without exception set

    b = Bar(); assert 0 < b

        -> SystemError: new style getargs format but argument is not a tuple

As far as I know (and the PSL docs say) these are the only valid ways to
give up __coerce__. Guido has in the past provided a hint to the latter
error:

http://mail.zope.org/pipermail/zope-coders/2002-January/000594.html

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL



More information about the ZODB-Dev mailing list