diff options
author | Andrej Shadura <andrewsh@debian.org> | 2021-05-11 16:41:38 +0200 |
---|---|---|
committer | Andrej Shadura <andrewsh@debian.org> | 2021-05-11 16:41:38 +0200 |
commit | 8b13141dd36d5784fe820afa06aa21a0c5735155 (patch) | |
tree | 12ac731328b325992ab80b1c8cecf4ed79f7935b /synapse/storage/_base.py | |
parent | 55e3da6770137d9858028903525a99764b39e8b3 (diff) |
New upstream version 1.33.2
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r-- | synapse/storage/_base.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index 24090532..6b68d872 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2017-2018 New Vector Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. @@ -17,13 +16,13 @@ import logging import random from abc import ABCMeta -from typing import TYPE_CHECKING, Any, Iterable, Optional, Union +from typing import TYPE_CHECKING, Any, Collection, Iterable, Optional, Union 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.storage.types import Connection -from synapse.types import Collection, StreamToken, get_domain_from_id +from synapse.types import StreamToken, get_domain_from_id from synapse.util import json_decoder if TYPE_CHECKING: @@ -115,7 +114,7 @@ def db_to_json(db_content: Union[memoryview, bytes, bytearray, str]) -> Any: db_content = db_content.tobytes() # Decode it to a Unicode string before feeding it to the JSON decoder, since - # Python 3.5 does not support deserializing bytes. + # it only supports handling strings if isinstance(db_content, (bytes, bytearray)): db_content = db_content.decode("utf8") |