diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-05-24 12:58:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-24 12:58:37 -0500 |
commit | 36501068d8f4d2e360b647b677cee99f91f8c4e6 (patch) | |
tree | 8f2353d312937f62a3dc0b60713625b18d4be332 /synapse/util | |
parent | Merge pull request #3245 from NotAFile/batch-iter (diff) | |
parent | use stand-in value if maxint is not available (diff) | |
download | synapse-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__.py | 7 |
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 |