Alexandre Vassalotti alexan...@peadrop.com added the comment:
OK I am convinced, the current behavior is fine. Let's close this one.
--
resolution: - wont fix
stage: needs patch - committed/rejected
status: open - closed
___
Python tracker
Antoine Pitrou pit...@free.fr added the comment:
You can call the detach() method if you don't want to the underlying
stream to be closed.
We could also add a close_parent attribute defaulting to True.
--
components: +IO
nosy: +benjamin.peterson, pitrou
type: behavior - feature request
New submission from Alexandre Vassalotti alexan...@peadrop.com:
Here's an example of the behaviour:
import io
def test(buf):
textio = io.TextIOWrapper(buf)
buf = io.BytesIO()
test(buf)
print(buf.closed) # This prints True currently
The problem here is TextIOWrapper closes its buffer