[issue22836] Broken "Exception ignored in:" message on exceptions in __repr__

Martin Panter report at bugs.python.org
Mon Nov 10 12:17:39 CET 2014


Martin Panter added the comment:

This is one that has often bugged me. When your repr() implementation is broken, it is quite confusing figuring out what is going wrong. Falling back to object.__repr__() is one option, however I would probably be happy with a simple “exception in repr()” message, and a proper newline.

Another way that I have come across this is:

$ python -c 'import sys; sys.stdout.detach()'
Exception ignored in: [no newline]

The workaround there is to set sys.stdout = None. In that case I think repr(sys.stdout) is trying to say “ValueError: underlying buffer has been detached”.

----------
nosy: +vadmium

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


More information about the Python-bugs-list mailing list