You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segmentation fault on Qt5Agg when using the wrong linestyle #6816
plot sanitizes the input, so this just produces a ValueError.
import matplotlib.pyplot as plt
plt.plot([0, 1], [1, 2], linestyle='.-')
The backends Qt4Agg and TkAgg also raise an error, but don't produce a hard crash.
My system is Python 3.5 on a virtual environment with matplotlib built from source via pip.
Full traceback for the aborting snippet:
Traceback (most recent call last):
File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/backends/backend_qt5agg.py", line 176, in __draw_idle_agg
FigureCanvasAgg.draw(self)
File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py", line 474, in draw
self.figure.draw(self.renderer)
File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/figure.py", line 1159, in draw
func(*args)
File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/axes/_base.py", line 2324, in draw
a.draw(renderer)
File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/patches.py", line 494, in draw
gc.set_linestyle(self._linestyle)
File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 1064, in set_linestyle
raise ValueError('Unrecognized linestyle: %s' % str(style))
ValueError: Unrecognized linestyle: .-
Aborted (core dumped)
I guess in __draw_idle_agg we could catch and print the exceptions? That would get us back to the status-quo without overriding it for the rest of qt5?
Activity
tacaswell commentedon Jul 22, 2016
What version of mpl are you using?
Dapid commentedon Jul 22, 2016
Sorry, I forgot. 1.5.1, latest on Pypi
anntzer commentedon Sep 6, 2016
I can confirm the issue as of 1.5.1 and PyQt 5.6 (5.7 doesn't work with 1.5.1), but it is fixed as of 2.0b3 with both PyQt5.6 and 5.7.
tacaswell commentedon Sep 6, 2016
@anntzer do we have any idea what fixed it? There is likely to still be a 1.5.3.
anntzer commentedon Sep 6, 2016
Bisected back to 3ef3f5b (basically, throwing exceptions at draw time is always going to be fatal for Qt5).
tacaswell commentedon Sep 6, 2016
ew, that is not something we can backport to 1.5
I suspect we are going to be playing wack-a-mole with qt5 for a while if raising at draw time is fatal...
anntzer commentedon Sep 6, 2016
See http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html#unhandled-python-exceptions
Basically you can avoid this by overwriting
sys.excepthook, but I'd rather not go that route...tacaswell commentedon Sep 6, 2016
I guess in
__draw_idle_aggwe could catch and print the exceptions? That would get us back to the status-quo without overriding it for the rest of qt5?anntzer commentedon Sep 6, 2016
I guess that could work, yes.