-
Notifications
You must be signed in to change notification settings - Fork 782
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
Py/PyAny: remove PartialEq impl and add is() #2183
Conversation
8b00b4f
to
b98d285
Compare
The guide entry presumes #2175 as merged. |
/// Returns whether the object is the same as the other. | ||
/// | ||
/// This is equivalent to the Python expression `self is other`. | ||
pub fn is<U: AsPyPointer>(&self, o: &U) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this inherit the #[inline]
attribute from the PartialEq
method? (Similarly for the method on PyAny
.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think probably makes sense for this to be #[inline]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for updating migration notes too. It's a shame we can't deprecate trait implementations, however I would hope that any breaking changes users have to undergo are also removing possible bugs from their code 😄
/// Returns whether the object is the same as the other. | ||
/// | ||
/// This is equivalent to the Python expression `self is other`. | ||
pub fn is<U: AsPyPointer>(&self, o: &U) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think probably makes sense for this to be #[inline]
.
Clippy fix needs rebasing on #2184 |
I actually found a semi-bug; you can see it in the tests (test_sequence and _pyproto), where vector of objects was compared directly to It works since small integers are singletons in CPython, so I kept the logic the same for now, but that's not a guarantee and maybe should be changed to use |
b98d285
to
cf1f3df
Compare
BTW, a simple
for me now. I can run with nightly, but then the UI tests usually fail, which is not pretty. |
cf1f3df
to
50edcb2
Compare
Yeah I was getting annoyed by this too. It should be fixed with #2176 You can delete the rustdocflags in |
Looks great, I'm just going to hold off on merging this for a moment until #2175 is ready. |
3e8025c
to
dc539fa
Compare
and fix the fallout, mostly in tests.
dc539fa
to
2d3caa1
Compare
and fix the fallout, mostly in tests.
See #2175 (comment) for discussion.