Skip to content

Commit 8bf2b15

Browse files
tacaswellQuLogic
authored andcommitted
FIX: try @vdrhtc to fix ctrl-c on windows
1 parent a05a2ac commit 8bf2b15

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/matplotlib/backends/qt_compat.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,14 @@ def _maybe_allow_interrupt(qapp):
228228
rsock.fileno(), _enum('QtCore.QSocketNotifier.Type').Read
229229
)
230230

231+
rsock.setblocking(False)
231232
# Clear the socket to re-arm the notifier.
232-
sn.activated.connect(lambda *args: rsock.recv(1))
233+
@sn.activated.connect
234+
def _may_clear_sock(*args):
235+
try:
236+
rsock.recv(1)
237+
except BlockingIOError:
238+
pass
233239

234240
def handle(*args):
235241
nonlocal handler_args

0 commit comments

Comments
 (0)