Skip to content

Commit

Permalink
Fix bug where pickle protocol is ignored
Browse files Browse the repository at this point in the history
Fixes #252
  • Loading branch information
lericson committed Aug 15, 2019
1 parent b6cd043 commit d8bafe9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/_pylibmcmodule.c
Expand Up @@ -148,6 +148,8 @@ static int PylibMC_Client_init(PylibMC_Client *self, PyObject *args,
PyObject *behaviors = NULL;
memcached_return rc;

self->pickle_protocol = -1;

static char *kws[] = { "servers", "binary", "username", "password",
"behaviors", NULL };

Expand Down Expand Up @@ -216,8 +218,6 @@ static int PylibMC_Client_init(PylibMC_Client *self, PyObject *args,
}
self->native_deserialization = (uint8_t) native_deserialization;

self->pickle_protocol = -1;

while ((c_srv = PyIter_Next(srvs_it)) != NULL) {
unsigned char stype;
char *hostname;
Expand Down
5 changes: 5 additions & 0 deletions tests/doctests.txt
Expand Up @@ -321,6 +321,11 @@ True
>>> mc.get('foo')
('bar', 'quuz')

With reference to bug #252
>>> c = make_test_client(behaviors={'pickle_protocol': 2})
>>> int(c.behaviors['pickle_protocol'])
2

Compression shouldn't break anything
>>> c = make_test_client(_pylibmc.client, binary=True)

Expand Down

0 comments on commit d8bafe9

Please sign in to comment.