Skip to content

Commit 268984f

Browse files
authored
Merge pull request #884 from neptyneco/check-thread-ident
2 parents 378af4b + 730a812 commit 268984f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ipykernel/iostream.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,12 @@ def flush(self):
455455
456456
send will happen in the background thread
457457
"""
458-
if self.pub_thread and self.pub_thread.thread is not None and self.pub_thread.thread.is_alive():
458+
if (
459+
self.pub_thread
460+
and self.pub_thread.thread is not None
461+
and self.pub_thread.thread.is_alive()
462+
and self.pub_thread.thread.ident != threading.current_thread().ident
463+
):
459464
# request flush on the background thread
460465
self.pub_thread.schedule(self._flush)
461466
# wait for flush to actually get through, if we can.

0 commit comments

Comments
 (0)