Skip to content

Commit 9c9fbc6

Browse files
davidbrochartianthomas23
authored andcommitted
Fix OutStream using _fid before being defined (#1373)
1 parent e5f1dfc commit 9c9fbc6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ipykernel/iostream.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ def _watch_pipe_fd(self):
383383
384384
"""
385385

386+
if self._fid is None:
387+
return
388+
386389
try:
387390
bts = os.read(self._fid, PIPE_BUFFER_SIZE)
388391
while bts and self._should_watch:
@@ -434,6 +437,7 @@ def __init__(
434437
)
435438
# This is necessary for compatibility with Python built-in streams
436439
self.session = session
440+
self._fid = None
437441
if not isinstance(pub_thread, IOPubThread):
438442
# Backward-compat: given socket, not thread. Wrap in a thread.
439443
warnings.warn(

0 commit comments

Comments
 (0)