Issue #18408: Fix zlib.compressobj() to handle PyThread_allocate_lock() failure

(MemoryError).
This commit is contained in:
Victor Stinner 2013-07-09 00:29:03 +02:00
parent 3f15cf0961
commit bf2e2f9bdf
1 changed files with 4 additions and 0 deletions

View File

@ -132,6 +132,10 @@ newcompobject(PyTypeObject *type)
}
#ifdef WITH_THREAD
self->lock = PyThread_allocate_lock();
if (self->lock == NULL) {
PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock");
return NULL;
}
#endif
return self;
}