--- Modules/threadmodule.c.old 2008-07-14 04:20:35.000000000 +0200 +++ Modules/threadmodule.c 2008-07-14 04:20:40.000000000 +0200 @@ -25,12 +25,13 @@ static void lock_dealloc(lockobject *self) { - assert(self->lock_lock); - /* Unlock the lock so it's safe to free it */ - PyThread_acquire_lock(self->lock_lock, 0); - PyThread_release_lock(self->lock_lock); + if (self->lock_lock) { + /* Unlock the lock so it's safe to free it */ + PyThread_acquire_lock(self->lock_lock, 0); + PyThread_release_lock(self->lock_lock); - PyThread_free_lock(self->lock_lock); + PyThread_free_lock(self->lock_lock); + } PyObject_Del(self); } @@ -148,7 +149,7 @@ return NULL; self->lock_lock = PyThread_allocate_lock(); if (self->lock_lock == NULL) { - PyObject_Del(self); + Py_DECREF(self); self = NULL; PyErr_SetString(ThreadError, "can't allocate lock"); } Index: Modules/pyexpat.c =================================================================== --- Modules/pyexpat.c (révision 64942) +++ Modules/pyexpat.c (copie de travail) @@ -1136,13 +1136,7 @@ if (self->buffer != NULL) { new_parser->buffer = malloc(new_parser->buffer_size); if (new_parser->buffer == NULL) { -#ifndef Py_TPFLAGS_HAVE_GC - /* Code for versions 2.0 and 2.1 */ - PyObject_Del(new_parser); -#else - /* Code for versions 2.2 and later. */ - PyObject_GC_Del(new_parser); -#endif + Py_DECREF(new_parser); return PyErr_NoMemory(); } } Index: Modules/_elementtree.c =================================================================== --- Modules/_elementtree.c (révision 64942) +++ Modules/_elementtree.c (copie de travail) @@ -328,7 +328,7 @@ if (attrib != Py_None) { if (element_new_extra(self, attrib) < 0) { - PyObject_Del(self); + Py_DECREF(self); return NULL; } @@ -2244,14 +2244,14 @@ self->entity = PyDict_New(); if (!self->entity) { - PyObject_Del(self); + Py_DECREF(self); return NULL; } self->names = PyDict_New(); if (!self->names) { - PyObject_Del(self->entity); - PyObject_Del(self); + Py_DECREF(self->entity); + Py_DECREF(self); return NULL; } @@ -2261,9 +2261,9 @@ self->parser = EXPAT(ParserCreate_MM)(encoding, &memory_handler, "}"); if (!self->parser) { - PyObject_Del(self->names); - PyObject_Del(self->entity); - PyObject_Del(self); + Py_DECREF(self->names); + Py_DECREF(self->entity); + Py_DECREF(self); PyErr_NoMemory(); return NULL; } @@ -2273,9 +2273,9 @@ target = treebuilder_new(); if (!target) { EXPAT(ParserFree)(self->parser); - PyObject_Del(self->names); - PyObject_Del(self->entity); - PyObject_Del(self); + Py_DECREF(self->names); + Py_DECREF(self->entity); + Py_DECREF(self); return NULL; } } else