[New-bugs-announce] [issue24560] codecs.StreamReader doesn't work with nonblocking streams: TypeError: can't concat bytes to NoneType

yac report at bugs.python.org
Fri Jul 3 17:12:04 CEST 2015


New submission from yac:

File "/usr/lib64/python3.4/codecs.py", line 490, in read
    data = self.bytebuffer + newdata
TypeError: can't concat bytes to NoneType


            if size < 0:
                newdata = self.stream.read()
            else:
                newdata = self.stream.read(size)
            # decode bytes (those remaining from the last call included)
            data = self.bytebuffer + newdata

if self.stream is nonblocking, it's read will return None (py3, py2 raises IOError(EGAIN)).

Simple `if newdata is None: return None` should fix that I guess

----------
components: Unicode
messages: 246186
nosy: ezio.melotti, haypo, yac
priority: normal
severity: normal
status: open
title: codecs.StreamReader doesn't work with nonblocking streams: TypeError: can't concat bytes to NoneType
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24560>
_______________________________________


More information about the New-bugs-announce mailing list