[Stackless] a stackless crash
Richard Tew
richard.m.tew at gmail.com
Tue Nov 6 10:12:27 CET 2007
On 11/6/07, Christian Tismer <tismer at stackless.com> wrote:
> This is not true, see the start of channelobject.c .
> The channel gets temporarily resurrected, and it is
> anyway visible through its members, since it is the
> head of the taskets that it contains.
> Therefore, it is possible to create new references,
> and the beast stays alive.
> Maybe this was a bad hack in order to save a pointer,
> but it is so right now.
We should probably add something like the following regardless (along
with a new channel 'zombie' flag of course). It wouldn't matter if
the programmer obtained references to a zombie channel as they
wouldn't be able to do anything with it.
static void
channel_clear(PyObject *ob)
{
PyChannelObject *ch = (PyChannelObject *) ob;
int dir = ch->balance > 0 ? 1 : -1;
self->flags.closing = 1;
self->flags.zombie = 1;
while (ch->balance) {
ob = (PyObject *) slp_channel_remove(ch, dir);
Py_DECREF(ob);
}
}
static PyObject *
channel_open(PyChannelObject *self)
{
if (self->flags.zombie)
RUNTIME_ERROR("cannot open a dying channel.", NULL);
self->flags.closing = 0;
Py_INCREF(Py_None);
return Py_None;
}
Richard.
More information about the Stackless
mailing list