Merge pull request #18214 from meeseeksmachine/auto-backport-of-pr-18… · matplotlib/matplotlib@d5f1d55 · GitHub
Skip to content

Commit d5f1d55

Browse files
authored
Merge pull request #18214 from meeseeksmachine/auto-backport-of-pr-18184-on-v3.3.x
Backport PR #18184 on branch v3.3.x (Go back to checking figures for their manager in destroy.)
2 parents 9908136 + 0745b37 commit d5f1d55

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

lib/matplotlib/_pylab_helpers.py

Lines changed: 4 additions & 3 deletions

lib/matplotlib/tests/test_backend_bases.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ def test_get_default_filename(tmpdir):
6060
assert filename == 'image.png'
6161

6262

63+
def test_canvas_change():
64+
fig = plt.figure()
65+
# Replaces fig.canvas
66+
canvas = FigureCanvasBase(fig)
67+
# Should still work.
68+
plt.close(fig)
69+
assert not plt.fignum_exists(fig.number)
70+
71+
6372
@pytest.mark.backend('pdf')
6473
def test_non_gui_warning(monkeypatch):
6574
plt.subplots()

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 7 additions & 2 deletions

0 commit comments

Comments
 (0)