Re: [Python-Dev] PyThreadState_SetAsyncExc, PyErr_Clear and native extensions

2006-05-11 Thread Martin v. Löwis
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 c

Re: [Python-Dev] PyThreadState_SetAsyncExc, PyErr_Clear and native extensions

2006-05-11 Thread Greg Ewing
Gabriel Becedillas wrote: > PyThreadState_SetAsyncExc was called when the thread was inside a > native extension, that for some reason calls PyErr_Clear. Maybe PyThreadState_SetAsyncExc should set a flag that says "this is an async exception, don't clear it", and have PyErr_Clear take notice of th

[Python-Dev] PyThreadState_SetAsyncExc, PyErr_Clear and native extensions

2006-05-11 Thread Gabriel Becedillas
I use PyThreadState_SetAsyncExc to stop a python thread but there are situations when the thread doesn't stop and continues executing normally. After some debugging, I realized that the problem is that PyThreadState_SetAsyncExc was called when the thread was inside a native extension, that for some