Title: codecs.StreamReader doesn't work with nonblocking streams: TypeError: can't concat bytes to NoneType
Type: Stage:
Components: Unicode Versions: Python 3.4
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, vstinner, yac
Priority: normal Keywords:

Created on 2015-07-03 15:12 by yac, last changed 2015-07-04 15:20 by vstinner.

Messages (2)
msg246186 - (view) Author: yac (yac) Date: 2015-07-03 15:12
File "/usr/lib64/python3.4/", line 490, in read
    data = self.bytebuffer + newdata
TypeError: can't concat bytes to NoneType

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

if 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
msg246261 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-07-04 15:20
Use the io module instead using the open() function.
Date User Action Args
2015-07-04 15:20:04vstinnersetmessages: + msg246261
2015-07-03 15:12:04yaccreate