[issue23093] repr() on detached stream objects fails

2014-12-21 Thread Martin Panter
Martin Panter added the comment: Here is patch v2, which ignores any exception derived from the Exception base class when reading the self.name etc properties. I’m interested what people think of this approach. -- Added file: http://bugs.python.org/file37523/detach-indep.v2.patch

[issue23093] repr() on detached stream objects fails

2014-12-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It looks reasonable to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23093 ___ ___ Python-bugs-list

[issue23093] repr() on detached stream objects fails

2014-12-21 Thread Roundup Robot
Roundup Robot added the comment: New changeset f3ff3e424b6f by Benjamin Peterson in branch '3.4': allow more operations to work on detached streams (closes #23093) https://hg.python.org/cpython/rev/f3ff3e424b6f New changeset afa8d8ab0937 by Benjamin Peterson in branch '2.7': allow more

[issue23093] repr() on detached stream objects fails

2014-12-20 Thread Martin Panter
New submission from Martin Panter: Patch to fix the underlying issue I mentioned in msg230955. After calling detach() on one of the BufferedIOBase wrappers or a TextIOWrapper, most operations will raise an exception. My patch ensures the following operations are still usable, because they are

[issue23093] repr() on detached stream objects fails

2014-12-20 Thread Serhiy Storchaka
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

[issue23093] repr() on detached stream objects fails

2014-12-20 Thread Martin Panter
Martin Panter added the comment: Damn, detaching the intermediate buffered stream is a bit more awkward. The difference between the “io” and “_pyio” implementations boils down to: * io.BufferedReader/Writer/RWPair.name properties raise a ValueError if the stream is detached *