[Python-Dev] isatty() on closed StringIO (was: Iterating a closed StringIO)
walter at livinglogic.de
Fri Nov 18 13:15:33 CET 2005
Guido van Rossum wrote:
> On 11/17/05, Walter Dörwald <walter at livinglogic.de> wrote:
>>Am 17.11.2005 um 22:03 schrieb Guido van Rossum:
>>>On 11/17/05, Walter Dörwald <walter at livinglogic.de> wrote:
>>>>Currently StringIO.StringIO and cStringIO.StringIO behave differently
>>>>when iterating a closed stream:
> I hope there isn't anyone here who believes this patch would be a bad idea?
BTW, isatty() has a similar problem:
>>> import StringIO, cStringIO
>>> s = StringIO.StringIO()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.4/StringIO.py", line 93, in isatty
File "/usr/local/lib/python2.4/StringIO.py", line 40, in
raise ValueError, "I/O operation on closed file"
ValueError: I/O operation on closed file
>>> s = cStringIO.StringIO()
I guess cStringIO.StringIO.isatty() should raise an exception too.
More information about the Python-Dev