[pypy-issue] Issue #3042: crash when reading non-blocking subprocess output (pypy/pypy)

Jacob Lifshay issues-reply at bitbucket.org
Tue Jul 9 04:47:22 EDT 2019

New issue 3042: crash when reading non-blocking subprocess output

Jacob Lifshay:


RPython traceback:
  File "pypy_interpreter.c", line 37926, in BuiltinCode_funcrun_obj
  File "pypy_module__io_1.c", line 11207, in W_BufferedReader_readline_w
  File "implement_2.c", line 32105, in dispatcher_70
  File "pypy_module__io.c", line 15998, in W_BufferedReader__raw_read
Traceback (most recent call last):
  File "pypy_bug.py", line 10, in <module>
    s = p.stdout.readline()
SystemError: unexpected internal exception (please report a bug): <BlockingIOError object at 0x7f9481569f00>; internal traceback was dumped to stderr

Python 3.6.1 \(7a2e437acfce, Mar 21 2019, 13:39:41\)  
\[PyPy 7.2.0-beta0 with GCC 6.2.0 20160901\]  
Ubuntu 18.04 x86\_64

reproducable using:

import subprocess
import fcntl
import os
from select import select

p = subprocess.Popen(["/bin/bash", "-c", "printf ''"], stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=None)
fl = fcntl.fcntl(p.stdout, fcntl.F_GETFL)
fcntl.fcntl(p.stdout, fcntl.F_SETFL, fl | os.O_NONBLOCK)
while True:
    s = p.stdout.readline()
    if len(s) == 0:
        if p.poll() is not None:
            select([p.stdout], [], [], 1.0)
        except InterruptedError:

More information about the pypy-issue mailing list