diff options
author | Joe Gordon <jogo@pinterest.com> | 2018-09-06 17:08:04 -0700 |
---|---|---|
committer | Joe Gordon <jogo@pinterest.com> | 2018-09-06 17:38:30 -0700 |
commit | 9ed0caa19ac3843c3449e2d4603bc0ec9327b2a1 (patch) | |
tree | ed9a1c696905741dd788d2d5c0eb30fd86e4dd87 /test-requirements.txt | |
parent | b80eb74ba6878fed12a543a4dbdd4154cfdc0c06 (diff) | |
download | pymemcache-9ed0caa19ac3843c3449e2d4603bc0ec9327b2a1.tar.gz |
Fix support newbytes from future
Previously python2 code using python-future to backport the py3 bytes
behavior would trigger the following exception:
code:
from builtins import bytes as newbytes
from pymemcache.client.base import Client
client = Client(('localhost', 11211))
client.set(newbytes('key'), 'value')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 297, in set
return self._store_cmd(b'set', key, expire, noreply, value)
File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 770, in _store_cmd
key = self.check_key(key)
File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 251, in check_key
key_prefix=self.key_prefix)
File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 91, in _check_key
key = key.encode('ascii')
File "/usr/local/lib/python2.7/site-packages/future/types/newbytes.py", line 381, in __getattribute__
raise AttributeError("encode method has been disabled in newbytes")
AttributeError: encode method has been disabled in newbytes
Add a test case for this and fix.
Diffstat (limited to 'test-requirements.txt')
-rw-r--r-- | test-requirements.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test-requirements.txt b/test-requirements.txt index 7bcdf2e..5c3424a 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,3 +4,4 @@ pytest-cov gevent==1.3.6; "PyPy" not in platform_python_implementation pylibmc python-memcached +future |