In Python 2 when calling Proxy(a) == Proxy(b) the method a.__cmp__(b) is used. In this case b gets unwrapped by wrap_richcompare
If the class of a gains a new __eq__ method to support Python 3 __eq__ is preferred over __cmp__ but __eq__ gets the object it should compare to security proxied.
See the excellent in depth analysis of @jamadden in zopefoundation/zope.keyreference#6
To have equal behaviour for classes which implement __eq__ instead of __cmp__ @jamadden suggests to implement __eq__ directly on the proxy. I think this will be a proper solution.
In Python 2 when calling
Proxy(a) == Proxy(b)the methoda.__cmp__(b)is used. In this casebgets unwrapped by wrap_richcompareIf the class of
agains a new__eq__method to support Python 3__eq__is preferred over__cmp__but__eq__gets the object it should compare to security proxied.See the excellent in depth analysis of @jamadden in zopefoundation/zope.keyreference#6
To have equal behaviour for classes which implement
__eq__instead of__cmp__@jamadden suggests to implement__eq__directly on the proxy. I think this will be a proper solution.