[New-bugs-announce] [issue35762] subprocess.Popen with universal_newlines and nonblocking streams failes with "can't concat NoneType to bytes"

Samuel Bayer report at bugs.python.org
Thu Jan 17 10:22:48 EST 2019


New submission from Samuel Bayer <sam at mitre.org>:

This bug is probably related to issue 24560.

This:

>>> import subprocess, fcntl, os
>>>> p = subprocess.Popen(["python", "-c", 'import time; time.sleep(5)'], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, universal_newlines= True)
>>> fcntl.fcntl(p.stderr.fileno(), fcntl.F_SETFL, os.O_NONBLOCK | fcntl.fcntl(p.stderr.fileno(), fcntl.F_GETFL))
>>> p.stderr.read()

causes this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/codecs.py", line 321, in decode
    data = self.buffer + input
TypeError: can't concat NoneType to bytes

I'm assuming the problem is that the underlying unbuffered stream returns None and the incremental byte decoder that's induced by universal_newlines = True isn't expecting it.

----------
components: IO
messages: 333883
nosy: sambayer
priority: normal
severity: normal
status: open
title: subprocess.Popen with universal_newlines and nonblocking streams failes with "can't concat NoneType to bytes"
type: crash
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35762>
_______________________________________


More information about the New-bugs-announce mailing list