Skip to content

Commit e80b5e6

Browse files
committed
add closed attribute to IPKernelApp
1 parent c3a67fb commit e80b5e6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ipykernel/kernelapp.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ def abs_connection_file(self):
204204
Interrupt this process when the parent is signaled.
205205
""",
206206
).tag(config=True)
207+
closed = Bool(
208+
True,
209+
help="whether this is closed",
210+
)
207211

208212
def init_crash_handler(self):
209213
"""Initialize the crash handler."""
@@ -532,6 +536,8 @@ def reset_io(self):
532536
533537
restores state after init_io
534538
"""
539+
if self.closed:
540+
return
535541
stdout, stderr, displayhook = sys.stdout, sys.stderr, sys.displayhook
536542
sys.stdout, sys.stderr, sys.displayhook = self._original_io
537543
if (finish_displayhook := getattr(displayhook, "finish_displayhook",

0 commit comments

Comments
 (0)