-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: be very paranoid about checking what the current canvas is #25573
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
base: main
Are you sure you want to change the base?
Conversation
Perhaps the simpler check would be Alternatively, we could additionally record |
I think that would still miss the "middle removed" issue as we have references that skip generations and we should avoid adding more hard-references than we strictly need.... But I will change to |
54db976
to
7100b57
Compare
lib/matplotlib/widgets.py
Outdated
# no canvas, something is very fishy | ||
if self.canvas is None: | ||
return True | ||
return self.canvas is not self.canvas.figure.canvas |
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.
Can be made one-liner as return self.canvas is not None and self.canvas is not self.canvas.figure.canvas
.
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.
Modulo CI, and with an optional additional comment.
Co-authored-by: Antony Lee <[email protected]>
Hmm, we are back to not being careful enough...but only an azure?! |
That's a bit fishy, but perhaps just change all the |
PR Summary
closes #25572
There are many ways for things to end up in odd states, the goal here is to detect if the the canvas has changed under us when trying to manage the state of widgets.
PR Checklist
Documentation and Tests
pytest
passes)Release Notes
.. versionadded::
directive in the docstring and documented indoc/users/next_whats_new/
.. versionchanged::
directive in the docstring and documented indoc/api/next_api_changes/
next_whats_new/README.rst
ornext_api_changes/README.rst