Closed
Description
The following short example produces a segmentation fault when using the default macosx
backend (of course on macOS):
from functools import partial
import matplotlib.pyplot as plt
def close_event(event, fig):
plt.close(fig)
fig, ax = plt.subplots()
close_callback = partial(close_event, fig=fig)
fig.canvas.mpl_connect("close_event", close_callback)
plt.show(block=False) # block=True works
To reproduce, run the script with python example.py
. This produces the following segfault:
[1] 62624 segmentation fault python example.py
Running the code in interactive mode works. Also, block=True
does not produce the segfault.
This script also runs normally with the PyQt5
backend, e.g. MPLBACKEND=qt5agg python example.py
, so it seems like this is an issue with the macosx
backend.
- Operating system: macOS 10.15.4
- Matplotlib version: 3.2.1
- Matplotlib backend: macosx
- Python version: 3.8.2
I can reproduce this problem with Homebrew Python as well as Anaconda.