diff --git a/oslo_serialization/jsonutils.py b/oslo_serialization/jsonutils.py index 5bd1f43..0e758c3 100644 --- a/oslo_serialization/jsonutils.py +++ b/oslo_serialization/jsonutils.py @@ -34,27 +34,9 @@ import datetime import functools import inspect import itertools -import sys +import json import uuid -is_simplejson = False -if sys.version_info < (2, 7): - # On Python <= 2.6, json module is not C boosted, so try to use - # simplejson module if available - try: - import simplejson as json - # NOTE(mriedem): Make sure we have a new enough version of simplejson - # to support the namedobject_as_tuple argument. This can be removed - # in the Kilo release when python 2.6 support is dropped. - if 'namedtuple_as_object' in inspect.getargspec(json.dumps).args: - is_simplejson = True - else: - import json - except ImportError: - import json -else: - import json - from oslo_utils import encodeutils from oslo_utils import importutils from oslo_utils import timeutils @@ -193,8 +175,6 @@ def dumps(obj, default=to_primitive, **kwargs): Use dump_as_bytes() to ensure that the result type is ``bytes`` on Python 2 and Python 3. """ - if is_simplejson: - kwargs['namedtuple_as_object'] = False return json.dumps(obj, default=default, **kwargs) @@ -234,8 +214,6 @@ def dump(obj, fp, *args, **kwargs): The *default* parameter now uses :func:`to_primitive` by default. """ default = kwargs.get('default', to_primitive) - if is_simplejson: - kwargs['namedtuple_as_object'] = False return json.dump(obj, fp, default=default, *args, **kwargs) diff --git a/oslo_serialization/tests/test_jsonutils.py b/oslo_serialization/tests/test_jsonutils.py index 5dc21c5..6e0fd3f 100644 --- a/oslo_serialization/tests/test_jsonutils.py +++ b/oslo_serialization/tests/test_jsonutils.py @@ -21,7 +21,6 @@ import mock import netaddr from oslo_i18n import fixture from oslotest import base as test_base -import simplejson import six import six.moves.xmlrpc_client as xmlrpclib @@ -36,7 +35,7 @@ class JSONUtilsTestMixin(object): super(JSONUtilsTestMixin, self).setUp() self.json_patcher = mock.patch.multiple( jsonutils, json=self.json_impl, - is_simplejson=self.json_impl is simplejson) + ) self.json_impl_mock = self.json_patcher.start() def tearDown(self): @@ -108,10 +107,6 @@ class JSONUtilsTestJson(JSONUtilsTestMixin, test_base.BaseTestCase): json_impl = json -class JSONUtilsTestSimpleJson(JSONUtilsTestMixin, test_base.BaseTestCase): - json_impl = simplejson - - class ToPrimitiveTestCase(test_base.BaseTestCase): def setUp(self): super(ToPrimitiveTestCase, self).setUp() diff --git a/test-requirements.txt b/test-requirements.txt index ce89cff..037edd8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -10,6 +10,5 @@ sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 -simplejson>=2.2.0 oslo.i18n>=1.5.0 # Apache-2.0 coverage>=3.6