summaryrefslogtreecommitdiffstats
path: root/Modules/_blake2/blake2b_impl.c
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2017-09-07 16:56:24 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-09-07 16:56:24 (GMT)
commita6a4dc816d68df04a7d592e0b6af8c7ecc4d4344 (patch)
tree1c31738009bee903417cea928e705a112aea2392 /Modules/_blake2/blake2b_impl.c
parent1f06a680de465be0c24a78ea3b610053955daa99 (diff)
downloadcpython-a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344.zip
cpython-a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344.tar.gz
cpython-a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344.tar.bz2
bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config * Always define WITH_THREAD for compatibility.
Diffstat (limited to 'Modules/_blake2/blake2b_impl.c')
-rw-r--r--Modules/_blake2/blake2b_impl.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/Modules/_blake2/blake2b_impl.c b/Modules/_blake2/blake2b_impl.c
index ec9e3c1..b1ae3e9 100644
--- a/Modules/_blake2/blake2b_impl.c
+++ b/Modules/_blake2/blake2b_impl.c
@@ -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);
}