diff options
author | Antoine Pitrou <pitrou@free.fr> | 2017-09-07 18:56:24 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2017-09-07 18:56:24 +0200 |
commit | a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344 (patch) | |
tree | 1c31738009bee903417cea928e705a112aea2392 /Modules/zlibmodule.c | |
parent | 1f06a680de465be0c24a78ea3b610053955daa99 (diff) | |
download | cpython-git-a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344.tar.gz |
bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
Diffstat (limited to 'Modules/zlibmodule.c')
-rw-r--r-- | Modules/zlibmodule.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 32dd817434..cf086de757 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -10,17 +10,12 @@ #include "zlib.h" -#ifdef WITH_THREAD - #include "pythread.h" - #define ENTER_ZLIB(obj) \ - Py_BEGIN_ALLOW_THREADS; \ - PyThread_acquire_lock((obj)->lock, 1); \ - Py_END_ALLOW_THREADS; - #define LEAVE_ZLIB(obj) PyThread_release_lock((obj)->lock); -#else - #define ENTER_ZLIB(obj) - #define LEAVE_ZLIB(obj) -#endif +#include "pythread.h" +#define ENTER_ZLIB(obj) \ + Py_BEGIN_ALLOW_THREADS; \ + PyThread_acquire_lock((obj)->lock, 1); \ + Py_END_ALLOW_THREADS; +#define LEAVE_ZLIB(obj) PyThread_release_lock((obj)->lock); #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1221 # define AT_LEAST_ZLIB_1_2_2_1 @@ -51,9 +46,7 @@ typedef struct char eof; int is_initialised; PyObject *zdict; - #ifdef WITH_THREAD - PyThread_type_lock lock; - #endif + PyThread_type_lock lock; } compobject; static void @@ -112,14 +105,12 @@ newcompobject(PyTypeObject *type) Py_DECREF(self); return NULL; } -#ifdef WITH_THREAD self->lock = PyThread_allocate_lock(); if (self->lock == NULL) { Py_DECREF(self); PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock"); return NULL; } -#endif return self; } @@ -615,9 +606,7 @@ zlib_decompressobj_impl(PyObject *module, int wbits, PyObject *zdict) static void Dealloc(compobject *self) { -#ifdef WITH_THREAD PyThread_free_lock(self->lock); -#endif Py_XDECREF(self->unused_data); Py_XDECREF(self->unconsumed_tail); Py_XDECREF(self->zdict); |