[New-bugs-announce] [issue6361] I/O object wrappers shouldn't close their underlying file when deleted.
Alexandre Vassalotti
report at bugs.python.org
Mon Jun 29 02:49:52 CEST 2009
New submission from Alexandre Vassalotti <alexandre at 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 <report at bugs.python.org>
<http://bugs.python.org/issue6361>
_______________________________________
More information about the New-bugs-announce
mailing list