diff --git a/changelog.d/8259.misc b/changelog.d/8259.misc new file mode 100644 index 0000000000000000000000000000000000000000..a26779a664c773ad144cf801edad54ef9f925b2e --- /dev/null +++ b/changelog.d/8259.misc @@ -0,0 +1 @@ +Switch to the JSON implementation from the standard library. diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py index 2a2c9e6f131a4f3457853e2665b612bb8a073e41..bb33345be60e0d48b80209baa7440bd0aa378ebc 100644 --- a/synapse/api/filtering.py +++ b/synapse/api/filtering.py @@ -15,10 +15,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import json from typing import List import jsonschema -from canonicaljson import json from jsonschema import FormatChecker from synapse.api.constants import EventContentFields diff --git a/synapse/app/admin_cmd.py b/synapse/app/admin_cmd.py index b6c90856706cfab21031cc20c476c71b161ecde8..7d309b1bb00a292aef52b9bf11aa325add9093a2 100644 --- a/synapse/app/admin_cmd.py +++ b/synapse/app/admin_cmd.py @@ -14,13 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. import argparse +import json import logging import os import sys import tempfile -from canonicaljson import json - from twisted.internet import defer, task import synapse diff --git a/synapse/util/__init__.py b/synapse/util/__init__.py index 3ad4b28fc73b61c32e853f79dd4dfe9443b6531b..b2355700adbcfdfaf3f3967555738ca390a0ffe1 100644 --- a/synapse/util/__init__.py +++ b/synapse/util/__init__.py @@ -13,11 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json import logging import re import attr -from canonicaljson import json from twisted.internet import defer, task diff --git a/synapse/util/frozenutils.py b/synapse/util/frozenutils.py index 0e445e01d7737e022bf258e81018e46b5cca3009..bf094c9386784f51c8d13ae94dfaa735bf9a2a17 100644 --- a/synapse/util/frozenutils.py +++ b/synapse/util/frozenutils.py @@ -13,7 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from canonicaljson import json +import json + from frozendict import frozendict @@ -66,5 +67,5 @@ def _handle_frozendict(obj): # A JSONEncoder which is capable of encoding frozendicts without barfing. # Additionally reduce the whitespace produced by JSON encoding. frozendict_json_encoder = json.JSONEncoder( - default=_handle_frozendict, separators=(",", ":"), + allow_nan=False, separators=(",", ":"), default=_handle_frozendict, )