Issue6361
Created on 2009-06-29 00:49 by alexandre.vassalotti, last changed 2009-06-29 11:46 by pitrou.
|
msg89803 - (view) |
Author: Alexandre Vassalotti (alexandre.vassalotti) |
Date: 2009-06-29 00:49 |
|
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.
|
|
msg89827 - (view) |
Author: Antoine Pitrou (pitrou) |
Date: 2009-06-29 11:46 |
|
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.
|
|
| Date |
User |
Action |
Args |
| 2009-06-29 11:46:06 | pitrou | set | nosy:
+ pitrou, benjamin.peterson messages:
+ msg89827
components:
+ IO type: behavior -> feature request |
| 2009-06-29 00:49:51 | alexandre.vassalotti | create | |
|