Author mark_t_russell
Recipients christian.heimes, gvanrossum, mark_t_russell, rhettinger
Date 2007-12-10.20:56:41
SpamBayes Score 0.0529708
Marked as misclassified No
Message-id <>
As Guido requested I've split off the generic reversed() and __reversed__()
doc additions to this patch against 2.6:

The I/O error from reversed(open("/etc/passwd")) was caused by the inner
TextIOWrapper calling close() (via the inherited IOBase.__del__() method).
I've fixed it by having TextIOReverseIterator keep a reference to the file
object, and added a test case for the bug.

I think it's at least questionable that TextIOWrapper.close() is calling 
buffer.close() on a buffer that it did not create.  I assumed that keeping
a reference to the buffer object would be enough to keep the buffer open,
and I suspect this is likely to trip up others in future.  I think
TextIOWrapper.close() should probably just set a flag (for the use of its 
own closed() method) and rely on reference counting to call close() 
on the buffer object.  If that sounds on the right lines I'm happy to think
about it a bit more and submit a patch.
File name Uploaded
reverse-file-iterator-20071210.diff mark_t_russell, 2007-12-10.20:56:41
Date User Action Args
2007-12-10 20:56:44mark_t_russellsetspambayes_score: 0.0529708 -> 0.0529708
recipients: + mark_t_russell, gvanrossum, rhettinger, christian.heimes
2007-12-10 20:56:44mark_t_russellsetspambayes_score: 0.0529708 -> 0.0529708
messageid: <>
2007-12-10 20:56:44mark_t_russelllinkissue1677872 messages
2007-12-10 20:56:44mark_t_russellcreate