so it should be fixed, or at least checked for conformness by the code.-tomerOn 8/11/06, Tim Peters
[EMAIL PROTECTED] wrote:[tomer filiba] while working on a library for raising exceptions in the context
of another thread, i've come across a bug in PyThreadState_SetAsyncExc. if i raise an instance, sys.exc_info() 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 workingas intended.This follows from the code in
ceval.c that raises theexception:if (tstate-async_exc != NULL) {x = tstate-async_exc;tstate-async_exc = NULL;
PyErr_SetNone(x);Py_DECREF(x);why = WHY_EXCEPTION;goto on_error;
}PyErr_SetNone(x) there gives no possibility that setting an /instance/could work as you hope -- `x` has to be an exception type, andtstate-async_exc is simply the `exc` argument that was passed to
PyThreadState_SetAsyncExc().
___
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