Serhiy Storchaka added the comment: The issue is still here.
>>> f = open('/dev/null') >>> f <_io.TextIOWrapper name='/dev/null' mode='r' encoding='UTF-8'> >>> f.buffer.detach() <_io.FileIO name='/dev/null' mode='rb' closefd=True> >>> f Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: raw stream has been detached Python implementation works. >>> import _pyio >>> f = _pyio.open('/dev/null') >>> f <_pyio.TextIOWrapper name='/dev/null' mode='r' encoding='UTF-8'> >>> f.buffer.detach() <_io.FileIO name='/dev/null' mode='rb' closefd=True> >>> f <_pyio.TextIOWrapper mode='r' encoding='UTF-8'> >>> f = _pyio.open('/dev/null') >>> f.detach() <_pyio.BufferedReader name='/dev/null'> >>> f <_pyio.TextIOWrapper mode='r' encoding='UTF-8'> >>> f = _pyio.open('/dev/null', 'rb') >>> f <_pyio.BufferedReader name='/dev/null'> >>> f.detach() <_io.FileIO name='/dev/null' mode='rb' closefd=True> >>> f <_pyio.BufferedReader> I would be good to make Python and C implementation match. ---------- nosy: +benjamin.peterson, hynek, pitrou, serhiy.storchaka, stutzbach stage: -> patch review versions: +Python 2.7, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23093> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com