Mitar <mmi...@gmail.com> added the comment:
I have a similar problem that text wrapper is closing the handle, and if I want to make a workaround, it also fails: buffer = io.Bytes() with io.TextIOWrapper(buffer, encoding='utf8') as text_buffer: write_content_to(text_buffer) text_buffer.flush() text_buffer.detach() Now this fails when context manager is trying to close the text_buffer with an error that it is already detached. If I do not detach it, then it closes buffer as well. ---------- nosy: +mitar _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue21363> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com