diff --git a/CHANGES.txt b/CHANGES.txt index 149f896d1d720f7b425eac030dbc06b29f44ff50_Q0hBTkdFUy50eHQ=..13730022c53b4f0d078f7cb39d832efc1a88b8ba_Q0hBTkdFUy50eHQ= 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,8 @@ +Version 3.7.2 released 2015-05-22 + +* Do not cache Decimal class in encoder, only reference the decimal module. + This may make reload work in more common scenarios. + Version 3.7.1 released 2015-05-18 * Fix compilation with MSVC diff --git a/conf.py b/conf.py index 149f896d1d720f7b425eac030dbc06b29f44ff50_Y29uZi5weQ==..13730022c53b4f0d078f7cb39d832efc1a88b8ba_Y29uZi5weQ== 100644 --- a/conf.py +++ b/conf.py @@ -36,7 +36,7 @@ # General substitutions. project = 'simplejson' -copyright = '2014, Bob Ippolito' +copyright = '2015, Bob Ippolito' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. @@ -44,7 +44,7 @@ # The short X.Y version. version = '3.7' # The full version, including alpha/beta/rc tags. -release = '3.7.1' +release = '3.7.2' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: diff --git a/setup.py b/setup.py index 149f896d1d720f7b425eac030dbc06b29f44ff50_c2V0dXAucHk=..13730022c53b4f0d078f7cb39d832efc1a88b8ba_c2V0dXAucHk= 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ DistutilsPlatformError IS_PYPY = hasattr(sys, 'pypy_translation_info') -VERSION = '3.7.1' +VERSION = '3.7.2' DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python" with open('README.rst', 'r') as f: diff --git a/simplejson/__init__.py b/simplejson/__init__.py index 149f896d1d720f7b425eac030dbc06b29f44ff50_c2ltcGxlanNvbi9fX2luaXRfXy5weQ==..13730022c53b4f0d078f7cb39d832efc1a88b8ba_c2ltcGxlanNvbi9fX2luaXRfXy5weQ== 100644 --- a/simplejson/__init__.py +++ b/simplejson/__init__.py @@ -98,7 +98,7 @@ Expecting property name: line 1 column 3 (char 2) """ from __future__ import absolute_import -__version__ = '3.7.1' +__version__ = '3.7.2' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder', diff --git a/simplejson/encoder.py b/simplejson/encoder.py index 149f896d1d720f7b425eac030dbc06b29f44ff50_c2ltcGxlanNvbi9lbmNvZGVyLnB5..13730022c53b4f0d078f7cb39d832efc1a88b8ba_c2ltcGxlanNvbi9lbmNvZGVyLnB5 100644 --- a/simplejson/encoder.py +++ b/simplejson/encoder.py @@ -3,7 +3,8 @@ from __future__ import absolute_import import re from operator import itemgetter -from decimal import Decimal +# Do not import Decimal directly to avoid reload issues +import decimal from .compat import u, unichr, binary_type, string_types, integer_types, PY3 def _import_speedups(): try: @@ -337,7 +338,7 @@ self.namedtuple_as_object, self.tuple_as_array, int_as_string_bitcount, self.item_sort_key, self.encoding, self.for_json, - self.ignore_nan, Decimal) + self.ignore_nan, decimal.Decimal) else: _iterencode = _make_iterencode( markers, self.default, _encoder, self.indent, floatstr, @@ -346,7 +347,7 @@ self.namedtuple_as_object, self.tuple_as_array, int_as_string_bitcount, self.item_sort_key, self.encoding, self.for_json, - Decimal=Decimal) + Decimal=decimal.Decimal) try: return _iterencode(o, 0) finally: @@ -389,7 +390,7 @@ _PY3=PY3, ValueError=ValueError, string_types=string_types, - Decimal=Decimal, + Decimal=None, dict=dict, float=float, id=id, @@ -399,6 +400,8 @@ str=str, tuple=tuple, ): + if _use_decimal and Decimal is None: + Decimal = decimal.Decimal if _item_sort_key and not callable(_item_sort_key): raise TypeError("item_sort_key must be None or callable") elif _sort_keys and not _item_sort_key: