summary refs log tree commit diff
path: root/synapse/util/caches
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-05-28 18:57:23 +1000
committerAmber Brown <hawkowl@atleastfornow.net>2018-05-28 18:57:23 +1000
commit754826a8305b3f32a45367cb6bd8bb26bd489a6b (patch)
treec5aba5e1e720474b3f94d15bd9202bda0b120e20 /synapse/util/caches
parentpepeightttt (diff)
parentMerge pull request #3288 from matrix-org/rav/no_spam_guests (diff)
downloadsynapse-754826a8305b3f32a45367cb6bd8bb26bd489a6b.tar.xz
Merge remote-tracking branch 'origin/develop' into 3218-official-prom
Diffstat (limited to 'synapse/util/caches')
-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 e0c22df249..d968b71e7a 100644
--- a/synapse/util/caches/__init__.py
+++ b/synapse/util/caches/__init__.py
@@ -17,6 +17,9 @@ from prometheus_client.core import Gauge, REGISTRY, GaugeMetricFamily
 
 import os
 
+from six.moves import intern
+import six
+
 CACHE_SIZE_FACTOR = float(os.environ.get("SYNAPSE_CACHE_FACTOR", 0.5))
 
 caches_by_name = {}
@@ -110,7 +113,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