-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: Ensuring both x and y attrs of LocationEvent are int #11530
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
Conversation
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.
Test failure is real (x and y are sometimes None; whether that should indeed ever happen is another question).
Anyone can dismiss this once fixed.
Because I missed a bug. This is why we have CI!
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.
Please pass None though.
lib/matplotlib/backend_bases.py
Outdated
self.x = x # x position - pixels from left of canvas | ||
self.y = y # y position - pixels from right of canvas | ||
# x position - pixels from left of canvas | ||
self.x = int(x) if x is not None else 0 |
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.
We should probably leave the current behavior of x and y being allowed to be None. I am not sure why that is allowed, but we should not change it!
The only place, where |
Hi @TarasKuzyo |
Hi @NelleV, should this test simulate |
@TarasKuzyo no, I would go for something simpler, that checks that in the object is created with a float, it is casted properly as an integer during the object initialization. It's more targeted and way easier to implement, but also a good way to check we don't accidentally remove this feature. |
Thanks @TarasKuzyo ! |
PR Summary
Fixes issue #11496. Both
x
andy
attributes ofmatplotlib.backend_bases.LocationEvent
are casted toint
in the constructor.PR Checklist