Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objects having __eq__ behave different from ones which only have __cmp__ #50

Open
icemac opened this issue Dec 30, 2017 · 2 comments · May be fixed by #51
Open

Objects having __eq__ behave different from ones which only have __cmp__ #50

icemac opened this issue Dec 30, 2017 · 2 comments · May be fixed by #51

Comments

@icemac
Copy link
Member

icemac commented Dec 30, 2017

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.

@dataflake
Copy link
Member

@icemac Is this still an issue?

@icemac
Copy link
Member Author

icemac commented Jan 16, 2023

@dataflake I do not think that it has been solved, yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants