FIX: be more cautious about checking widget size#30484
Merged
ksunden merged 3 commits intomatplotlib:mainfrom Aug 29, 2025
Merged
FIX: be more cautious about checking widget size#30484ksunden merged 3 commits intomatplotlib:mainfrom
ksunden merged 3 commits intomatplotlib:mainfrom
Conversation
QuLogic
reviewed
Aug 29, 2025
Member
QuLogic
left a comment
There was a problem hiding this comment.
We seem to have an _isdeleted; should we be using that?
timhoffm
reviewed
Aug 29, 2025
| if self.height() <= 0 or self.width() <= 0: | ||
| return | ||
| except RuntimeError: | ||
| # This can happen if the c++ object is already cleaned up |
Member
There was a problem hiding this comment.
Can we check the error message to ensure we’re not swallowing other potential RuntimeErrors?
Also, are we sure this is the only place that may access the C++ object?
Member
Author
Yes and than also handles Tim's comment. |
This can fail if the c++ side of the object has already been cleaned up but the Python side is still lingering (due to refs in callbacks). closes matplotlib#29618
4821cd6 to
4b0a26a
Compare
Member
Author
|
I confirmed this also fixes the reproduce I found. |
Member
|
Test failures appear to be related to a new release of https://pypi.org/project/coverage/#history https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst#version-7106--2025-08-29 EDIT: Was not coverage, was pytest-rerunfailures |
ksunden
approved these changes
Aug 29, 2025
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
Aug 29, 2025
ksunden
added a commit
that referenced
this pull request
Aug 29, 2025
…484-on-v3.10.x Backport PR #30484 on branch v3.10.x (FIX: be more cautious about checking widget size)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This can fail if the c++ side of the object has already been cleaned up but the Python side is still lingering (due to refs in callbacks).
closes #29618
I do not think it is worth constructing a test to generate this case, but in the case where I saw it in the wild this fixed the tests locally for me.
PR checklist