FIX: Ensuring both x and y attrs of LocationEvent are int#11530
FIX: Ensuring both x and y attrs of LocationEvent are int#11530NelleV merged 7 commits intomatplotlib:masterfrom
Conversation
anntzer
left a comment
There was a problem hiding this comment.
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!
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.
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
xandyattributes ofmatplotlib.backend_bases.LocationEventare casted tointin the constructor.PR Checklist