On Dec 2, 2007 11:29 AM, Chad Austin
Hi Antoine,
Antoine Pitrou wrote:
Hi,
(I was asked to forward this from the bug tracker)
We have also run into problems where a task tries to "return" (yield Return()) from within a try: except Exception: block. Since returning from a coroutine is roughly equivalent to "raise GeneratorExit", the exception can be caught and ignored, with the same consequences as above.
I may be missing something but why don't you just catch StandardError instead? If I believe Python 2.5's exception hierarchy it would catch anything under Exception except for GeneratorExit, StopIteration and the various Warnings.
If socket.error, xmlrpclib.Fault, httplib.HTTPException, etc. all extended StandardError, then we would probably be fine with that approach. But I think the majority of exceptions, both in the standard library and our code, extend Exception directly.
Note that StandardError was removed from py3k. n