mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config * Always define WITH_THREAD for compatibility.
This commit is contained in:
parent
1f06a680de
commit
a6a4dc816d
135 changed files with 2472 additions and 4377 deletions
|
|
@ -15,9 +15,7 @@
|
|||
|
||||
#include "Python.h"
|
||||
#include "pystrhex.h"
|
||||
#ifdef WITH_THREAD
|
||||
#include "pythread.h"
|
||||
#endif
|
||||
|
||||
#include "../hashlib.h"
|
||||
#include "blake2ns.h"
|
||||
|
|
@ -41,9 +39,7 @@ typedef struct {
|
|||
PyObject_HEAD
|
||||
blake2b_param param;
|
||||
blake2b_state state;
|
||||
#ifdef WITH_THREAD
|
||||
PyThread_type_lock lock;
|
||||
#endif
|
||||
} BLAKE2bObject;
|
||||
|
||||
#include "clinic/blake2b_impl.c.h"
|
||||
|
|
@ -60,11 +56,9 @@ new_BLAKE2bObject(PyTypeObject *type)
|
|||
{
|
||||
BLAKE2bObject *self;
|
||||
self = (BLAKE2bObject *)type->tp_alloc(type, 0);
|
||||
#ifdef WITH_THREAD
|
||||
if (self != NULL) {
|
||||
self->lock = NULL;
|
||||
}
|
||||
#endif
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
@ -292,7 +286,6 @@ _blake2b_blake2b_update(BLAKE2bObject *self, PyObject *obj)
|
|||
|
||||
GET_BUFFER_VIEW_OR_ERROUT(obj, &buf);
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
if (self->lock == NULL && buf.len >= HASHLIB_GIL_MINSIZE)
|
||||
self->lock = PyThread_allocate_lock();
|
||||
|
||||
|
|
@ -305,9 +298,6 @@ _blake2b_blake2b_update(BLAKE2bObject *self, PyObject *obj)
|
|||
} else {
|
||||
blake2b_update(&self->state, buf.buf, buf.len);
|
||||
}
|
||||
#else
|
||||
blake2b_update(&self->state, buf.buf, buf.len);
|
||||
#endif /* !WITH_THREAD */
|
||||
PyBuffer_Release(&buf);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
|
@ -407,12 +397,10 @@ py_blake2b_dealloc(PyObject *self)
|
|||
/* Try not to leave state in memory. */
|
||||
secure_zero_memory(&obj->param, sizeof(obj->param));
|
||||
secure_zero_memory(&obj->state, sizeof(obj->state));
|
||||
#ifdef WITH_THREAD
|
||||
if (obj->lock) {
|
||||
PyThread_free_lock(obj->lock);
|
||||
obj->lock = NULL;
|
||||
}
|
||||
#endif
|
||||
PyObject_Del(self);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue