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 when deleted.
BufferedRWPair behalves similarly. The solution is simply to override
the __del__ method of TextIOWrapper inherited from IOBase.

----------
messages: 89803
nosy: alexandre.vassalotti
priority: normal
severity: normal
stage: needs patch
status: open
title: I/O object wrappers shouldn't close their underlying file when deleted.
type: behavior
versions: Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6361>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to