Author serhiy.storchaka
Recipients benjamin.peterson, hynek, martin.panter, pitrou, serhiy.storchaka, stutzbach
Date 2014-12-20.16:42:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1419093747.81.0.469743388402.issue23093@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-12-20 16:42:27serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, benjamin.peterson, stutzbach, hynek, martin.panter
2014-12-20 16:42:27serhiy.storchakasetmessageid: <1419093747.81.0.469743388402.issue23093@psf.upfronthosting.co.za>
2014-12-20 16:42:27serhiy.storchakalinkissue23093 messages
2014-12-20 16:42:27serhiy.storchakacreate