Issue #18408: Fix zlib.compressobj() to handle PyThread_allocate_lock() failure
(MemoryError).
This commit is contained in:
parent
3f15cf0961
commit
bf2e2f9bdf
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue