summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-05-24 12:58:37 -0500
committerGitHub <noreply@github.com>2018-05-24 12:58:37 -0500
commit36501068d8f4d2e360b647b677cee99f91f8c4e6 (patch)
tree8f2353d312937f62a3dc0b60713625b18d4be332 /synapse/util
parentMerge pull request #3245 from NotAFile/batch-iter (diff)
parentuse stand-in value if maxint is not available (diff)
downloadsynapse-36501068d8f4d2e360b647b677cee99f91f8c4e6.tar.xz
Merge pull request #3247 from NotAFile/py3-misc
Misc Python3 fixes
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/caches/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/util/caches/__init__.py b/synapse/util/caches/__init__.py
index 4adae96681..329ccbb866 100644
--- a/synapse/util/caches/__init__.py
+++ b/synapse/util/caches/__init__.py
@@ -16,6 +16,9 @@
 import synapse.metrics
 import os
 
+from six.moves import intern
+import six
+
 CACHE_SIZE_FACTOR = float(os.environ.get("SYNAPSE_CACHE_FACTOR", 0.5))
 
 metrics = synapse.metrics.get_metrics_for("synapse.util.caches")
@@ -66,7 +69,9 @@ def intern_string(string):
         return None
 
     try:
-        string = string.encode("ascii")
+        if six.PY2:
+            string = string.encode("ascii")
+
         return intern(string)
     except UnicodeEncodeError:
         return string