Message232961
Here is a patch that substitutes an explanation if the repr() fails. Output now looks like this, terminated with a newline:
=== BrokenObj ===
Exception ignored in: <repr() failed>
Traceback (most recent call last):
File "<stdin>", line 3, in __del__
Exception: in del
$ ./python -c 'import sys; sys.stdout.detach()'
Exception ignored in: <repr() failed>
ValueError: underlying buffer has been detached
I also made it work sensibly if printing the exception message fails:
>>> class Exception(Exception):
... def __str__(self): raise Exception("Exception is broken")
...
>>> f = BrokenObj(); del f
Exception ignored in: <repr() failed>
Traceback (most recent call last):
File "<stdin>", line 3, in __del__
__main__.Exception: <str() failed>
>>> raise Exception()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
__main__.Exception: <str() failed>
>>> |
|
Date |
User |
Action |
Args |
2014-12-20 04:18:38 | martin.panter | set | recipients:
+ martin.panter, vstinner, Arfrever, r.david.murray, The Compiler |
2014-12-20 04:18:38 | martin.panter | set | messageid: <1419049118.12.0.397772596768.issue22836@psf.upfronthosting.co.za> |
2014-12-20 04:18:38 | martin.panter | link | issue22836 messages |
2014-12-20 04:18:37 | martin.panter | create | |
|