"Pythonj Fatal error: UNREF invalid object

Courageous jkraska at san.rr.com
Sat Dec 15 17:28:17 EST 2001


>+ Trying to delete an object twice (although I'd expect a memory fault
>  then, since deleting it the first time would have set
>  op->_ob_next = op->_ob_prev = NULL).

I'll check into this. I can't see how I would have accidentally
decref'd something too many times, but it's possible. I would
have expected a different answer to that.

>+ Not initializing an extension object correctly -- _Py_NewReference(ob)
>  has to get called when an object pops into existence, in order to
>  insert ob into refchain.  But PyObject_Init ususally does that for
>  you.

Right. I'll double check, but I think it's initialized correctly.

>If it's random memory corruption, perhaps defining SLOW_UNREF_CHECK will
>catch it earlier.

I'll try that, and thank you for the insight. The following should
look familiar. When I'm not getting the above described error, I'm
getting one here:

static void
reset_exc_info(PyThreadState *tstate)
{
	PyFrameObject *frame;
	PyObject *tmp_type, *tmp_value, *tmp_tb;
	frame = tstate->frame;
	if (frame->f_exc_type != NULL) {

Blip! frame itself is NULL. That's a bit too regular to be random,
although anything is possible. :-)

I didn't mention, but I'm doing some nasty ass shit. For one, I'm
escaping out of Python on a _cooperative_ multithread shift and
reentering later, sometimes returning to a prior shift point. Currently
this is always the same execution frame, but it's not guaranteed to
be. I wasn't quite sure if this was really possible, but I wanted to
give it a try anyway. N.B.: this is not preemptive multithreading,
so there is never more than one actual thread of execution inside of
the Python engine.

C//




More information about the Python-list mailing list