Attempt to be more performant on PyPy (#3462)

This commit is contained in:
Amber Brown 2018-06-28 14:49:57 +01:00 committed by GitHub
parent 72d2143ea8
commit 6350bf925e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 79 additions and 62 deletions

View file

@ -14,10 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
import simplejson
import sys
from canonicaljson import encode_canonical_json
from canonicaljson import encode_canonical_json, json
import six
from six import string_types, itervalues, iteritems
from twisted.internet import defer
@ -797,7 +796,7 @@ class EventCreationHandler(object):
# Ensure that we can round trip before trying to persist in db
try:
dump = frozendict_json_encoder.encode(event.content)
simplejson.loads(dump)
json.loads(dump)
except Exception:
logger.exception("Failed to encode content: %r", event.content)
raise