A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/088235.html below:

[Python-Dev] Should I/O object wrappers close their underlying buffer when deleted?

[Python-Dev] Should I/O object wrappers close their underlying buffer when deleted? [Python-Dev] Should I/O object wrappers close their underlying buffer when deleted?Alexandre Vassalotti alexandre at peadrop.com
Sun Apr 5 08:28:52 CEST 2009
Hello,

I would like to call to your attention the following behavior of TextIOWrapper:

   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.

-- Alexandre
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4