mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
Issue #18408: Fix zlib.compressobj() to handle PyThread_allocate_lock() failure
(MemoryError).
This commit is contained in:
parent
3f15cf0961
commit
bf2e2f9bdf
1 changed files with 4 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue