Commit bf2e2f9b authored by Victor Stinner's avatar Victor Stinner

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

(MemoryError).
parent 3f15cf09
...@@ -132,6 +132,10 @@ newcompobject(PyTypeObject *type) ...@@ -132,6 +132,10 @@ newcompobject(PyTypeObject *type)
} }
#ifdef WITH_THREAD #ifdef WITH_THREAD
self->lock = PyThread_allocate_lock(); self->lock = PyThread_allocate_lock();
if (self->lock == NULL) {
PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock");
return NULL;
}
#endif #endif
return self; 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