Showing content from http://mail.python.org/pipermail/python-dev/attachments/20060811/93b5d7e3/attachment.html below:
so it should be fixed, or at least checked for conformness by the code.<br><br><br>-tomer<br><br><div><span class="gmail_quote">On 8/11/06, <b class="gmail_sendername">Tim Peters</b> <<a href="mailto:tim.peters@gmail.com">
tim.peters@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">[tomer filiba]<br>> while working on a library for raising exceptions in the context
<br>> of another thread, i've come across a bug in PyThreadState_SetAsyncExc.<br>> if i raise an instance, sys.exc_info() confuses the exception value for<br>> the exception type, and the exception value is set None. if i raise the
<br>> type itself, the interpreter creates an instance internally, but then i can't<br>> pass arguments to the exception.<br><br>That appears to be the way it was designed; i.e., AFAICT, it's working<br>as intended. This follows from the code in
ceval.c that raises the<br>exception:<br><br> if (tstate->async_exc != NULL) {<br> x = tstate->async_exc;<br> tstate->async_exc = NULL;
<br> PyErr_SetNone(x);<br> Py_DECREF(x);<br> why = WHY_EXCEPTION;<br> goto on_error;
<br> }<br><br>PyErr_SetNone(x) there gives no possibility that setting an /instance/<br>could work as you hope -- `x` has to be an exception type, and<br>tstate->async_exc is simply the `exc` argument that was passed to
<br>PyThreadState_SetAsyncExc().<br></blockquote></div><br>
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