[Twisted-Python] UncatchableExceptions
<foom> exarkun: I suspect we should introduce a UncatchableExceptions constant somewhere <foom> exarkun: and require that all except:'s are preceded by except UncatchableExceptions: raise <exarkun> foom: It's possible that is a good idea. <exarkun> foom: I'm not really sure, though. <spiv> foom: With (KeyboardInterrupt, SystemExit, MemoryError, SystemError) ? <foom> spiv: yes I guess this would live in twisted.python somewhere, and the coding standard would be updated to require its use instead of bare "except:" Python-dev have discussed a similar measure for the python standard library (in the exceptions module), but hadn't come to any consensus last time I looked. Thoughts? Objections? -Andrew.
On Oct 29, 2004, at 17:52, Andrew Bennetts wrote:
<foom> exarkun: I suspect we should introduce a UncatchableExceptions constant somewhere <foom> exarkun: and require that all except:'s are preceded by except UncatchableExceptions: raise <exarkun> foom: It's possible that is a good idea. <exarkun> foom: I'm not really sure, though. <spiv> foom: With (KeyboardInterrupt, SystemExit, MemoryError, SystemError) ? <foom> spiv: yes
I guess this would live in twisted.python somewhere, and the coding standard would be updated to require its use instead of bare "except:"
Python-dev have discussed a similar measure for the python standard library (in the exceptions module), but hadn't come to any consensus last time I looked.
Thoughts? Objections?
Here is a link to the most recent discussion about this on python-dev: http://mail.python.org/pipermail/python-dev/2004-September/048609.html -bob
On Oct 30, 2004, at 12:06 AM, Bob Ippolito wrote:
On Oct 29, 2004, at 17:52, Andrew Bennetts wrote:
<foom> exarkun: I suspect we should introduce a UncatchableExceptions constant somewhere <foom> exarkun: and require that all except:'s are preceded by except UncatchableExceptions: raise <exarkun> foom: It's possible that is a good idea. <exarkun> foom: I'm not really sure, though. <spiv> foom: With (KeyboardInterrupt, SystemExit, MemoryError, SystemError) ? <foom> spiv: yes
I guess this would live in twisted.python somewhere, and the coding standard would be updated to require its use instead of bare "except:"
Python-dev have discussed a similar measure for the python standard library (in the exceptions module), but hadn't come to any consensus last time I looked.
Thoughts? Objections?
Here is a link to the most recent discussion about this on python-dev:
http://mail.python.org/pipermail/python-dev/2004-September/048609.html
I would like to point out that the method from the above-quoted IRC conversation is *NOT* what I'd like to see added in Python. I'd much prefer something like in the linked python-dev mail. _However_, Twisted is supposed to work on 2.2, 2.3, and 2.4, none of which have the hypothetical new exception hierarchy that doesn't suck. Therefore, IMO, the best solution to fix things in Twisted, that will both work right now, and forwardly compatible, is to do as above and require that all except:'s (and except Exception's) are preceded by an except somemodule.UncatchableExceptions. James
On Fri, 2004-10-29 at 23:52 +0200, Andrew Bennetts wrote:
<foom> exarkun: I suspect we should introduce a UncatchableExceptions constant somewhere <foom> exarkun: and require that all except:'s are preceded by except UncatchableExceptions: raise <exarkun> foom: It's possible that is a good idea. <exarkun> foom: I'm not really sure, though. <spiv> foom: With (KeyboardInterrupt, SystemExit, MemoryError, SystemError) ? <foom> spiv: yes
I guess this would live in twisted.python somewhere, and the coding standard would be updated to require its use instead of bare "except:"
Python-dev have discussed a similar measure for the python standard library (in the exceptions module), but hadn't come to any consensus last time I looked.
Thoughts? Objections?
Not an objection *per se*, but I think it would be better to see how the debate on python-dev turns out; I am pretty sure there are a lot of subtle issues to consider. For example, I could go either way on including SystemExit in that list; there have been many times, when working with Manhole or similar, that I've imported a script that wasn't intended for use as a module and had it attempt to exit the interpreter with a sys.exit; I was glad that except: really was a catch-all in those cases. I also ponder what a Deferred with a Failure whose value is MemoryError would mean :). In general, though, I think that the Throwable/Exception distinction, as in Java, is a pretty good idea.
participants (4)
-
Andrew Bennetts
-
Bob Ippolito
-
Glyph Lefkowitz
-
James Y Knight