mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
fix py3 intern and remove unnecessary py3 encode
Signed-off-by: Adrian Tschira <nota@notafile.com>
This commit is contained in:
parent
aafb0f6b0d
commit
73cbdef5f7
@ -16,6 +16,9 @@
|
|||||||
import synapse.metrics
|
import synapse.metrics
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from six.moves import intern
|
||||||
|
import six
|
||||||
|
|
||||||
CACHE_SIZE_FACTOR = float(os.environ.get("SYNAPSE_CACHE_FACTOR", 0.5))
|
CACHE_SIZE_FACTOR = float(os.environ.get("SYNAPSE_CACHE_FACTOR", 0.5))
|
||||||
|
|
||||||
metrics = synapse.metrics.get_metrics_for("synapse.util.caches")
|
metrics = synapse.metrics.get_metrics_for("synapse.util.caches")
|
||||||
@ -66,7 +69,9 @@ def intern_string(string):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
string = string.encode("ascii")
|
if six.PY2:
|
||||||
|
string = string.encode("ascii")
|
||||||
|
|
||||||
return intern(string)
|
return intern(string)
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
return string
|
return string
|
||||||
|
Loading…
Reference in New Issue
Block a user