[issue23093] repr() on detached stream objects fails

Martin Panter report at bugs.python.org
Sat Dec 20 23:01:00 CET 2014


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
* _pyio._BufferedIOMixin.name property returns “self.raw.name”. When detached, “self.raw” is None, so this causes an AttributeError.

This is significant because io.TextIOWrapper.__repr__() only handles AttributeError when accessing “self.buffer.name”. The best option that I can think of to fix this is to make all the repr() implementations handle this ValueError exception.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23093>
_______________________________________


More information about the Python-bugs-list mailing list