[Stackless] Killing a tasklet waiting on PyChannel_Receive in C module fails

Chris Jacobson mainecoon at gmail.com
Tue Feb 24 06:23:03 CET 2009


These changes had no effect on either of the test cases under 2.6.1 -
they both continue to loop, the exception is ignored back up in the
Python code.

The diffs you provided only alter PyErr_PrintEx() ?  Was there more to it?

- Chris

On Mon, Feb 23, 2009 at 3:33 PM, Richard Tew <richard.m.tew at gmail.com> wrote:
> On Mon, Feb 23, 2009 at 6:17 PM, Richard Tew <richard.m.tew at gmail.com> wrote:
>> On Mon, Feb 23, 2009 at 4:24 AM, Chris Jacobson <mainecoon at gmail.com> wrote:
>>> If a tasklet that is currently in a C function waiting on a
>>> PyChannel_Receive is killed from another tasklet, the receiving
>>> tasklet resumes with NULL returned on the Receive, and doesn't die.
>>
>> What version of Python are you using?  2.6, 3.0 or something earlier?
>
> Fixed.  In any case, I compiled against 3.0.1, as it was what I had
> locally.  I'll try 2.6 as well, but if you encounter any more bugs,
> please mention your platform and Python version.  I'll have to do
> rebuilds and rereleases of 3.0 and 3.0.1, so let's hope there's not
> any more :-)
>
> Cheers,
> Richard.
>
> Author: richard.tew
> Date: Tue Feb 24 00:27:50 2009
> New Revision: 69919
>
> Log:
> Fix for strange application restarting bug, where in some
> circumstances an exception was compared to SystemExit, and if it
> matched, the application was asked to exit.  TaskletExit is a subclass
> of SystemExit, which means that when it is raised, if it hits this
> execution path, the restarting occurs.
>
> Reported by Chris Jacobson.
>
> Modified:
>  stackless/branches/release30-maint/Python/pythonrun.c
>
> Modified: stackless/branches/release30-maint/Python/pythonrun.c
> ==============================================================================
> --- stackless/branches/release30-maint/Python/pythonrun.c       (original)
> +++ stackless/branches/release30-maint/Python/pythonrun.c       Tue
> Feb 24 00:27:50 2009
> @@ -1382,7 +1382,7 @@
>  {
>       PyObject *exception, *v, *tb, *hook;
>
> -       if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
> +       if (PyErr_ExceptionMatches(PyExc_SystemExit) &&
> !PyErr_ExceptionMatches(PyExc_TaskletExit)) {
>               handle_system_exit();
>       }
>       PyErr_Fetch(&exception, &v, &tb);
> @@ -1408,7 +1408,7 @@
>               PyObject *result = PyEval_CallObject(hook, args);
>               if (result == NULL) {
>                       PyObject *exception2, *v2, *tb2;
> -                       if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
> +                       if (PyErr_ExceptionMatches(PyExc_SystemExit)
> && !PyErr_ExceptionMatches(PyExc_TaskletExit)) {
>                               handle_system_exit();
>                       }
>                       PyErr_Fetch(&exception2, &v2, &tb2);
>




More information about the Stackless mailing list