Skip to content
Myr

Use detach for TextIOWrapper. See http://bugs.python.org/issue21363

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 7acef5f · Browse files · 1 file+4 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−6 removed

  • other:+4 added−6 removed

1 file+4 added−6 removed

modified:click/_compat.py+4 added-6 removed
33 unmodified lines
34 io.TextIOWrapper.__init__(self, _FixupStream(stream),35 encoding, errors)3637 def __del__(self):38 self.buffer._prevent_close = True38 try:39 self.detach()40 except Exception:41 pass424344class _FixupStream(object):45 """The new io interface needs more from streams than streams
2 unmodified lines
48 """4950 def __init__(self, stream):51 self._stream = stream49 self._prevent_close = False5253 def __getattr__(self, name):54 return getattr(self._stream, name)5554 def close(self):55 if not self._prevent_close:56 self._stream.close()5756 def read1(self, size):57 f = getattr(self._stream, 'read1', None)58 if f is not None:59 return f(size)
283 unmodified lines