classification
Title: readline fails on nonblocking, unbuffered io.FileIO objects
Type: behavior Stage: resolved
Components: IO, Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: duplicate
Dependencies: Superseder: The io module doesn't support non-blocking files
View: 13322
Assigned To: Nosy List: anacrolix, neologix
Priority: normal Keywords:

Created on 2012-01-25 05:13 by anacrolix, last changed 2012-01-25 08:22 by neologix. This issue is now closed.

Messages (2)
msg151933 - (view) Author: Matt Joiner (anacrolix) Date: 2012-01-25 05:13
_io._IOBase.readline doesn't seem to like _io.FileIO.read returning None, which occurs when it's unbuffered and nonblocking. (Modules/_io/fileio.c:745 in trunk). Can this be handled some other way?

$ python3.3
Python 3.3.0a0 (default:fb0f4fe8123e+, Jan 24 2012, 11:21:36) 
[GCC 4.6.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, io
>>> r, w = os.pipe2(os.O_NONBLOCK)
>>> f = io.open(r, 'rb', 0)
>>> f.readline()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: read() should have returned a bytes object, not 'NoneType'
msg151935 - (view) Author: Charles-Fran├žois Natali (neologix) * (Python committer) Date: 2012-01-25 08:22
> Can this be handled some other way?

Yeah, that's an hairy issue.
See #13322 for the details.
History
Date User Action Args
2012-01-25 08:22:32neologixsetstatus: open -> closed

superseder: The io module doesn't support non-blocking files

nosy: + neologix
messages: + msg151935
resolution: duplicate
stage: resolved
2012-01-25 05:13:47anacrolixcreate