diff --git a/memcache.py b/memcache.py index 05b6657..4b90fd6 100644 --- a/memcache.py +++ b/memcache.py @@ -895,6 +895,9 @@ def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0, server_keys, prefixed_to_orig_key = self._map_and_prefix_keys( six.iterkeys(mapping), key_prefix) + mapping = dict([(k[1] if type(k) is tuple else k, v) + for k, v in six.iteritems(mapping)]) + # send out all requests on each server before reading anything dead_servers = [] notstored = [] # original keys. diff --git a/tests/test_setmulti.py b/tests/test_setmulti.py index 756afe8..e1e9e0d 100644 --- a/tests/test_setmulti.py +++ b/tests/test_setmulti.py @@ -61,11 +61,11 @@ def tearDown(self): socket.socket = self.old_socket def test_Socket_Disconnect(self): - mapping = {'foo': 'FOO', 'bar': 'BAR'} + mapping = {'foo': 'FOO', 'bar': 'BAR', (0, 'foobar'): 'FOOBAR'} with captured_stderr() as log: bad_keys = self.mc.set_multi(mapping) self.assertIn('connection closed in readline().', log.getvalue()) - self.assertEqual(sorted(bad_keys), ['bar', 'foo']) + self.assertEqual(sorted(bad_keys), ['bar', 'foo', 'foobar']) if DEBUG: print('set_multi({0!r}) -> {1!r}'.format(mapping, bad_keys))