Gabriel Becedillas wrote: > Does anybody see any problem with this approach ?, Does anybody have a > cleaner/better solution ?
I don't think there *is* a solution: asynchronous exceptions and thread cancellation just cannot work. In the specific case, the caller of PyErr_Clear will continue its computation, instead of immediately leaving the function. To solve this specific problem, you would also have to give PyErr_Clear an int return code (whether or not the exception was cleared), and then you need to change all uses of PyErr_Clear to check for failure, and return immediately (after performing local cleanup, of course). You then need to come up with a protocol to determine whether an exception is "clearable"; the new exception hierarchy suggests that one should "normally" only catch Exception, and let any other BaseException through. So PyErr_Clear should grow a flag indicating whether you want to clear just all Exceptions, or indeed all BaseExceptions. Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com