summaryrefslogtreecommitdiff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2020-09-23 10:00:31 +0200
committerAndrej Shadura <andrewsh@debian.org>2020-09-23 10:00:31 +0200
commitc4b994b356a5af29bdf1f8648dd7d929a237acbd (patch)
tree6163eda9a9a5329caea1cf5b4ad42b974cc1ae3b /synapse/storage/_base.py
parenta8007890d174f089f2ce28aae9d919df346f74f9 (diff)
New upstream version 1.20.0
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index 6814bf5f..ab49d227 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -19,12 +19,11 @@ import random
from abc import ABCMeta
from typing import Any, Optional
-from canonicaljson import json
-
from synapse.storage.database import LoggingTransaction # noqa: F401
from synapse.storage.database import make_in_list_sql_clause # noqa: F401
from synapse.storage.database import DatabasePool
from synapse.types import Collection, get_domain_from_id
+from synapse.util import json_decoder
logger = logging.getLogger(__name__)
@@ -99,13 +98,13 @@ def db_to_json(db_content):
if isinstance(db_content, memoryview):
db_content = db_content.tobytes()
- # Decode it to a Unicode string before feeding it to json.loads, since
+ # Decode it to a Unicode string before feeding it to the JSON decoder, since
# Python 3.5 does not support deserializing bytes.
if isinstance(db_content, (bytes, bytearray)):
db_content = db_content.decode("utf8")
try:
- return json.loads(db_content)
+ return json_decoder.decode(db_content)
except Exception:
logging.warning("Tried to decode '%r' as JSON and failed", db_content)
raise