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

Commit 72bec36

Browse files
authored
Directly import json from the standard library. (#8259)
By importing from canonicaljson the simplejson module was still being used in some situations. After this change the std lib json is consistenty used throughout Synapse.
1 parent cef0021 commit 72bec36

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

changelog.d/8259.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Switch to the JSON implementation from the standard library.

synapse/api/filtering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
18+
import json
1819
from typing import List
1920

2021
import jsonschema
21-
from canonicaljson import json
2222
from jsonschema import FormatChecker
2323

2424
from synapse.api.constants import EventContentFields

synapse/app/admin_cmd.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
import argparse
17+
import json
1718
import logging
1819
import os
1920
import sys
2021
import tempfile
2122

22-
from canonicaljson import json
23-
2423
from twisted.internet import defer, task
2524

2625
import synapse

synapse/util/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
import json
1617
import logging
1718
import re
1819

1920
import attr
20-
from canonicaljson import json
2121

2222
from twisted.internet import defer, task
2323

synapse/util/frozenutils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from canonicaljson import json
16+
import json
17+
1718
from frozendict import frozendict
1819

1920

@@ -66,5 +67,5 @@ def _handle_frozendict(obj):
6667
# A JSONEncoder which is capable of encoding frozendicts without barfing.
6768
# Additionally reduce the whitespace produced by JSON encoding.
6869
frozendict_json_encoder = json.JSONEncoder(
69-
default=_handle_frozendict, separators=(",", ":"),
70+
allow_nan=False, separators=(",", ":"), default=_handle_frozendict,
7071
)

0 commit comments

Comments
 (0)