[pypy-issue] [issue847] Old style class equality test failure
tracker at bugs.pypy.org
Fri Aug 26 15:11:52 CEST 2011
Armin Rigo <armin.rigo at gmail.com> added the comment:
One problem is that the comparison operators behave subtly differently than the
other operations; that's why these three lines don't work for them.
For example, if class Base defines __eq__, and class Sub(Base) doesn't, then
Base() == Sub() will still be called first with the arguments switched; this is
different from e.g. __add__.
And of course this rule applies only to new-style classes, not to old-style
classes. For old-style classes, instead, we have a 3rd version of the rule,
which is that the order to try both operations is never reversed by subclassing
relationships between operands.
I checked in something that seems to make my hopefully exhaustive tests happy...
status: chatting -> testing
PyPy bug tracker <tracker at bugs.pypy.org>
More information about the pypy-issue