Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix comment that says cast is necessary for Python 3.5
Browse files Browse the repository at this point in the history
The comment was correct when we were using json.loads. But since
switching to our own JSONDecoder instead, the decode() function only
supports str-type arguments.

Switch happened in #8106.
  • Loading branch information
anoadragon453 committed Apr 23, 2021
1 parent 6fd2538 commit 0506cc9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion synapse/storage/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,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")

Expand Down

0 comments on commit 0506cc9

Please sign in to comment.