New submission from Steve Palmer <st...@srpalmer.me.uk>:

class io.BufferedIOBase states "In addition, those methods [read(), readinto() 
and write()] can raise BlockingIOError if the underlying raw stream is in 
non-blocking mode and cannot take or give enough data; unlike their RawIOBase 
counterparts, they will never return None."

However, class.io.BufferedReader (inheriting from io.BufferedIOBase) *does* 
return None in this case.  Admittedly, io.BufferedReader does says it is 
overriding the inherited method, but I'm surprised that change in behaviour 
declared for buffered objects, is reverted to the RarIOBase behaviour on a more 
specific class.

The attached file (a little long - sorry), simulates a slow non-blocking raw 
file, which it wraps in a BufferReader to test the behaviour defined in 
BufferedIOBase.

----------
files: read2.py
messages: 334630
nosy: steverpalmer
priority: normal
severity: normal
status: open
title: io.BufferReader.read() returns None
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48091/read2.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35869>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to