[Python-Dev] Iterating a closed StringIO

Walter Dörwald walter at livinglogic.de
Thu Nov 17 21:21:48 CET 2005


Currently StringIO.StringIO and cStringIO.StringIO behave differently 
when iterating a closed stream:

s = StringIO.StringIO("foo")
s.close()
s.next()

gives StopIteration, but

s = cStringIO.StringIO("foo")
s.close()
s.next()

gives "ValueError: I/O operation on closed file".

Should they raise the same exception? Should this be fixed for 2.5?

Bye,
    Walter Dörwald


More information about the Python-Dev mailing list