[Python-Dev] PyThreadState_SetAsyncExc bug? (original) (raw)
tomer filiba tomerfiliba at gmail.com
Fri Aug 11 14:08:39 CEST 2006
- Previous message: [Python-Dev] PyThreadState_SetAsyncExc bug?
- Next message: [Python-Dev] Dict suppressing exceptions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
so it should be fixed, or at least checked for conformness by the code.
-tomer
On 8/11/06, Tim Peters <tim.peters at gmail.com> wrote:
[tomer filiba] > while working on a library for raising exceptions in the context > of another thread, i've come across a bug in PyThreadStateSetAsyncExc. > if i raise an instance, sys.excinfo() confuses the exception value for > the exception type, and the exception value is set None. if i raise the > type itself, the interpreter creates an instance internally, but then i can't > pass arguments to the exception. That appears to be the way it was designed; i.e., AFAICT, it's working as intended. This follows from the code in ceval.c that raises the exception: if (tstate->asyncexc != NULL) { x = tstate->asyncexc; tstate->asyncexc = NULL; PyErrSetNone(x); PyDECREF(x); why = WHYEXCEPTION; goto onerror; } PyErrSetNone(x) there gives no possibility that setting an /instance/ could work as you hope --
x
has to be an exception type, and tstate->asyncexc is simply theexc
argument that was passed to PyThreadStateSetAsyncExc(). -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20060811/93b5d7e3/attachment.html
- Previous message: [Python-Dev] PyThreadState_SetAsyncExc bug?
- Next message: [Python-Dev] Dict suppressing exceptions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]