[issue10306] Weakref callback exceptions should be turned into warnings.

2010-11-04 Thread Julian
Julian added the comment: Thank you, Antoine, you make a good point. In my example, I am suppressing the warning, which, I agree isn't a good idea. In my real life usage, I was getting an unexpected exception in a callback in code written by another person. I wanted not to suppress the warnin

[issue10306] Weakref callback exceptions should be turned into warnings.

2010-11-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: The behaviour of weakrefs here mirrors what is already done for __del__ exceptions. Using warnings would mean that exceptions can get silenced implicitly (for example, if an exception happens twice at the same location) which is not very Pythonic: generally,

[issue10306] Weakref callback exceptions should be turned into warnings.

2010-11-03 Thread Julian
New submission from Julian : If a weakref callback raises an exception, weakref writes out some text (to stderr, I think) and ignores it. I think it would be more appropriate if weakref emitted that text using the Python warning module, to allow it to be better controlled. Consider this code