Martin Panter added the comment:

The documentation <https://docs.python.org/dev/library/io.html#io.IOBase> says 
“. . . calling any method (even inquiries) on a closed stream is undefined. 
Implementations may raise ValueError”. So IMO you shouldn’t rely on any 
particular success or failure behaviour of these methods when a stream is 
closed.

Having the stream methods waste time calling out to Python methods and 
descriptors like readable() and “closed” all the time can make things 
unnecessarily slow and inefficient (see my work at the end of Issue 18003 for 
example). On the other hand, removing the existing checks could potentially 
break someone’s code. I suggest closing this, unless someone has a specific 
proposal or reason to change.

----------
nosy: +vadmium

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

Reply via email to