Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove use of the Simplified GIL State API so pylibmc works in sub-in…

…terpreters

from commit 74d5f9a
  • Loading branch information...
commit ddd2f011f73d8ccc6347c5471eff378bef58dbd5 1 parent 7251349
John Watson authored
Showing with 2 additions and 6 deletions.
  1. +2 −6 _pylibmcmodule.c
View
8 _pylibmcmodule.c
@@ -675,15 +675,13 @@ static bool _PylibMC_RunSetCommand(PylibMC_Client* self,
_PylibMC_SetCommand f, char *fname,
pylibmc_mset* msets, size_t nkeys,
size_t min_compress) {
- PyGILState_STATE gstate;
memcached_st* mc = self->mc;
memcached_return rc = MEMCACHED_SUCCESS;
int pos;
bool error = false;
bool allsuccess = true;
- gstate = PyGILState_Ensure();
- PyGILState_Release(gstate);
+ Py_BEGIN_ALLOW_THREADS;
for (pos=0; pos < nkeys && !error; pos++) {
pylibmc_mset* mset = &msets[pos];
@@ -697,10 +695,8 @@ static bool _PylibMC_RunSetCommand(PylibMC_Client* self,
size_t compressed_len = 0;
if (min_compress && value_len >= min_compress) {
- gstate = PyGILState_Ensure();
_PylibMC_Deflate(value, value_len,
&compressed_value, &compressed_len);
- PyGILState_Release(gstate);
}
if (compressed_value != NULL) {
@@ -749,7 +745,7 @@ static bool _PylibMC_RunSetCommand(PylibMC_Client* self,
} /* end for each mset */
- gstate = PyGILState_Ensure();
+ Py_END_ALLOW_THREADS;
/* We only return the last return value, even for a _multi
operation, but we do set the success on the mset */
Please sign in to comment.
Something went wrong with that request. Please try again.