summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorAdrian Tschira <nota@notafile.com>2018-05-15 17:55:46 +0200
committerAdrian Tschira <nota@notafile.com>2018-05-19 17:35:31 +0200
commit73cbdef5f773ddd091713d71ac9c63639d7c0825 (patch)
tree8b3a9a49fc132cc95365fd5c94fbde75221e0492 /synapse
parentpy3-ize url preview (diff)
downloadsynapse-73cbdef5f773ddd091713d71ac9c63639d7c0825.tar.xz
fix py3 intern and remove unnecessary py3 encode
Signed-off-by: Adrian Tschira <nota@notafile.com>
Diffstat (limited to 'synapse')
-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