Author indygreg
Recipients indygreg, josh.r
Date 2019-03-23.17:04:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
It's also worth noting that if the wrapped stream close() cascading behavior should be configurable, then many additional types in the standard library need a constructor argument to control this behavior. e.g. io.TextIOWrapper, io.BufferedReader, io.BufferedWriter, codecs.StreamReader, codecs.StreamWriter, etc.

In my influenced-by-Rust mind, the problem is similar to "ownership." The question we seem to be dancing around is whether the stream wrapper "owns" the inner stream or just "borrows" it. If it "owns," then close() cascading absolutely makes sense. But if it just "borrows" the inner stream, then close() cascading should not occur. There are viable use cases for both scenarios on pretty much any stream wrapper. Since existing stream wrappers automatically perform close() cascading and __del__ will call close(), I'd be a bit surprised if others weren't complaining about the inability to disable close() cascade on stream wrappers! e.g. it is perfectly viable to want to temporarily wrap a binary stream with an io.TextIOWrapper but the forced close() cascading makes this difficult to do since destruction of the outer stream will close() the inner stream. So you end up needing to keep references to outer streams alive to prevent this. Eww.
Date User Action Args
2019-03-23 17:04:31indygregsetrecipients: + indygreg, josh.r
2019-03-23 17:04:31indygregsetmessageid: <>
2019-03-23 17:04:31indygreglinkissue36129 messages
2019-03-23 17:04:30indygregcreate