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 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 working > as intended. This follows from the code in ceval.c that raises the > exception: > > 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, and > tstate->async_exc is simply the `exc` argument that was passed to > PyThreadState_SetAsyncExc(). > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20060811/93b5d7e3/attachment.html
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4