summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Charriere <nicholas@pinterest.com>2016-10-03 15:45:27 -0700
committerNicholas Charriere <nicholas@pinterest.com>2016-10-03 15:45:27 -0700
commit93ffb33d786e7712a6dc915c7ae307ed6a98cbd7 (patch)
treed151770dacf0ab32dead220a12795bc88c6e2665
parenta1bf081754cd38de1a20925782a5404de00bd46d (diff)
downloadpymemcache-93ffb33d786e7712a6dc915c7ae307ed6a98cbd7.tar.gz
Improve syntax
-rw-r--r--pymemcache/client/base.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/pymemcache/client/base.py b/pymemcache/client/base.py
index 76bda96..515e456 100644
--- a/pymemcache/client/base.py
+++ b/pymemcache/client/base.py
@@ -82,7 +82,8 @@ STAT_TYPES = {
def _check_key(key, key_prefix=b''):
"""Checks key and add key_prefix."""
- if isinstance(key, six.text_type) or isinstance(key, six.string_types):
+ allowed_str_types = (six.text_type, six.string_types)
+ if isinstance(key, allowed_str_types):
try:
key = key.encode('ascii')
except (UnicodeEncodeError, UnicodeDecodeError):