MNT: Debug fig_size change after window close #29129
Draft
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 is a minimal reproducer for a failure in the pipeline #29125 (comment).
The
test_interactive_backend[toolmanager-MPLBACKEND=wxagg-BACKEND_DEPS=wx]
fails in the pipeline at the subsequentassert result.getvalue() == result_after.getvalue()
because the PNG data inresult
andresult_after
have different sizes (640x480) vs. (640x478); i.e.result_after
is two pixels smaller. This stems from a changed fig size, as made explicit by the assert statement added here (precisely,fig.get_size_inches()
changes fromnp.array([6.4, 4.8])
tonp.array([6.4, 4.78])
).I have not yet a clue why closing the figure window could change the figure size.Actually, showing the window changes the size, see below.Note: reading the exception is a bit complicated because it happens in a called subprocess, but you'll find this somewhere in the middle of the traceback:
Update: This is the call stack that leads to the changed figure size:
Apparently
show()
creates awx.EVT_SIZE
, which is bound to_FigureCanvasWxBase._on_size()
, and in therematplotlib/lib/matplotlib/backends/backend_wx.py
Line 659 in 1c4a554
returns the reduced height of 478.