This repository was archived by the owner on Apr 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-86
lines changed
Expand file tree Collapse file tree 3 files changed +14
-86
lines changed Original file line number Diff line number Diff line change @@ -158,9 +158,8 @@ jsonschema = ">=3.0.0"
158158immutabledict = " >=2.0"
159159# We require 2.1.0 or higher for type hints. Previous guard was >= 1.1.0
160160unpaddedbase64 = " >=2.1.0"
161- # We require 1.5.0 to work around an issue when running against the C implementation of
162- # frozendict: https://github.com/matrix-org/python-canonicaljson/issues/36
163- canonicaljson = " ^1.5.0"
161+ # We require 2.0.0 for immutabledict support.
162+ canonicaljson = " ^2.0.0"
164163# we use the type definitions added in signedjson 1.1.
165164signedjson = " ^1.1.0"
166165# validating SSL certs for IP addresses requires service_identity 18.1.
Original file line number Diff line number Diff line change 2020import json
2121import os
2222import sys
23+ from typing import Any , Dict
2324
2425from synapse .util .rust import check_rust_lib_up_to_date
2526from synapse .util .stringutils import strtobool
6364
6465# Use the standard library json implementation instead of simplejson.
6566try :
66- from canonicaljson import set_json_library
67+ from canonicaljson import register_preserialisation_callback , set_json_library
68+ from immutabledict import immutabledict
6769
6870 set_json_library (json )
71+
72+ def _immutabledict_cb (d : immutabledict ) -> Dict [str , Any ]:
73+ return d ._dict
74+
75+ register_preserialisation_callback (immutabledict , _immutabledict_cb )
6976except ImportError :
7077 pass
7178
You can’t perform that action at this time.
0 commit comments