Skip to content

Commit 0c1db09

Browse files
arieleizarieleizenbergblink1073
authored
Bugfix: binary stdout/stderr handling (ipython#1129)
Co-authored-by: Ariel Eizenberg <[email protected]> Co-authored-by: Steven Silvester <[email protected]>
1 parent a18f007 commit 0c1db09

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ipykernel/iostream.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
MASTER = 0
3030
CHILD = 1
3131

32+
PIPE_BUFFER_SIZE = 1000
33+
3234
# -----------------------------------------------------------------------------
3335
# IO classes
3436
# -----------------------------------------------------------------------------
@@ -367,11 +369,11 @@ def _watch_pipe_fd(self):
367369
"""
368370

369371
try:
370-
bts = os.read(self._fid, 1000)
372+
bts = os.read(self._fid, PIPE_BUFFER_SIZE)
371373
while bts and self._should_watch:
372-
self.write(bts.decode())
374+
self.write(bts.decode(errors='replace'))
373375
os.write(self._original_stdstream_copy, bts)
374-
bts = os.read(self._fid, 1000)
376+
bts = os.read(self._fid, PIPE_BUFFER_SIZE)
375377
except Exception:
376378
self._exc = sys.exc_info()
377379

0 commit comments

Comments
 (0)