Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ipykernel/iostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,12 @@ def flush(self):

send will happen in the background thread
"""
if self.pub_thread and self.pub_thread.thread is not None and self.pub_thread.thread.is_alive():
if (
self.pub_thread
and self.pub_thread.thread is not None
and self.pub_thread.thread.is_alive()
and self.pub_thread.thread.ident != threading.current_thread().ident
):
# request flush on the background thread
self.pub_thread.schedule(self._flush)
# wait for flush to actually get through, if we can.
Expand Down