Commit 8f3216a0 authored by Victor Stinner's avatar Victor Stinner

Merged revisions 78610 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78610 | victor.stinner | 2010-03-03 01:43:44 +0100 (mer., 03 mars 2010) | 3 lines

  Issue #3299: fix thread.allocate_lock() error handler, replace PyObject_Del()
  by Py_DECREF() to fix a crash in pydebug mode.
........
parent 6aa278ee
......@@ -27,14 +27,15 @@ typedef struct {
static void
lock_dealloc(lockobject *self)
{
assert(self->lock_lock);
if (self->in_weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *) self);
/* 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);
if (self->lock_lock != NULL) {
/* 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);
}
PyObject_Del(self);
}
......@@ -432,9 +433,9 @@ newlockobject(void)
self->lock_lock = PyThread_allocate_lock();
self->in_weakreflist = NULL;
if (self->lock_lock == NULL) {
PyObject_Del(self);
self = NULL;
Py_DECREF(self);
PyErr_SetString(ThreadError, "can't allocate lock");
return NULL;
}
return self;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment