simplejson 3.19.3__tar.gz → 3.20.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. {simplejson-3.19.3 → simplejson-3.20.2}/CHANGES.txt +10 -0
  2. {simplejson-3.19.3/simplejson.egg-info → simplejson-3.20.2}/PKG-INFO +12 -2
  3. {simplejson-3.19.3 → simplejson-3.20.2}/conf.py +3 -3
  4. {simplejson-3.19.3 → simplejson-3.20.2}/setup.py +3 -2
  5. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/__init__.py +1 -1
  6. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/_speedups.c +20 -14
  7. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/__init__.py +2 -0
  8. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_dump.py +6 -0
  9. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_float.py +8 -0
  10. {simplejson-3.19.3 → simplejson-3.20.2/simplejson.egg-info}/PKG-INFO +12 -2
  11. {simplejson-3.19.3 → simplejson-3.20.2}/LICENSE.txt +0 -0
  12. {simplejson-3.19.3 → simplejson-3.20.2}/MANIFEST.in +0 -0
  13. {simplejson-3.19.3 → simplejson-3.20.2}/README.rst +0 -0
  14. {simplejson-3.19.3 → simplejson-3.20.2}/index.rst +0 -0
  15. {simplejson-3.19.3 → simplejson-3.20.2}/scripts/make_docs.py +0 -0
  16. {simplejson-3.19.3 → simplejson-3.20.2}/setup.cfg +0 -0
  17. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/compat.py +0 -0
  18. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/decoder.py +0 -0
  19. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/encoder.py +0 -0
  20. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/errors.py +0 -0
  21. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/ordered_dict.py +0 -0
  22. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/raw_json.py +0 -0
  23. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/scanner.py +0 -0
  24. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/_cibw_runner.py +0 -0
  25. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_bigint_as_string.py +0 -0
  26. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_bitsize_int_as_string.py +0 -0
  27. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_check_circular.py +0 -0
  28. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_decimal.py +0 -0
  29. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_decode.py +0 -0
  30. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_default.py +0 -0
  31. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_encode_basestring_ascii.py +0 -0
  32. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_encode_for_html.py +0 -0
  33. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_errors.py +0 -0
  34. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_fail.py +0 -0
  35. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_for_json.py +0 -0
  36. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_indent.py +0 -0
  37. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_item_sort_key.py +0 -0
  38. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_iterable.py +0 -0
  39. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_namedtuple.py +0 -0
  40. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_pass1.py +0 -0
  41. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_pass2.py +0 -0
  42. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_pass3.py +0 -0
  43. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_raw_json.py +0 -0
  44. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_recursion.py +0 -0
  45. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_scanstring.py +0 -0
  46. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_separators.py +0 -0
  47. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_speedups.py +0 -0
  48. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_str_subclass.py +0 -0
  49. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_subclass.py +0 -0
  50. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_tool.py +0 -0
  51. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_tuple.py +0 -0
  52. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tests/test_unicode.py +0 -0
  53. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson/tool.py +0 -0
  54. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson.egg-info/SOURCES.txt +0 -0
  55. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson.egg-info/dependency_links.txt +0 -0
  56. {simplejson-3.19.3 → simplejson-3.20.2}/simplejson.egg-info/top_level.txt +0 -0
@@ -1,3 +1,13 @@
1
+ Version 3.20.2 released 2025-09-24
2
+
3
+ * Disable speedups on GraalPy smae as on PyPy
4
+ https://github.com/simplejson/simplejson/pull/339
5
+
6
+ Version 3.20.1 released 2025-02-14
7
+
8
+ * Do not memoize keys before they are coerced to string
9
+ https://github.com/simplejson/simplejson/pull/329
10
+
1
11
  Version 3.19.3 released 2024-08-14
2
12
 
3
13
  * Updated test & build matrix to include Python 3.13.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: simplejson
3
- Version: 3.19.3
3
+ Version: 3.20.2
4
4
  Summary: Simple, fast, extensible JSON encoder/decoder for Python
5
5
  Home-page: https://github.com/simplejson/simplejson
6
6
  Author: Bob Ippolito
@@ -33,6 +33,16 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
33
33
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
34
34
  Requires-Python: >=2.5, !=3.0.*, !=3.1.*, !=3.2.*
35
35
  License-File: LICENSE.txt
36
+ Dynamic: author
37
+ Dynamic: author-email
38
+ Dynamic: classifier
39
+ Dynamic: description
40
+ Dynamic: home-page
41
+ Dynamic: license
42
+ Dynamic: license-file
43
+ Dynamic: platform
44
+ Dynamic: requires-python
45
+ Dynamic: summary
36
46
 
37
47
  simplejson
38
48
  ----------
@@ -36,15 +36,15 @@ master_doc = 'index'
36
36
 
37
37
  # General substitutions.
38
38
  project = 'simplejson'
39
- copyright = '2023, Bob Ippolito'
39
+ copyright = '2025, Bob Ippolito'
40
40
 
41
41
  # The default replacements for |version| and |release|, also used in various
42
42
  # other places throughout the built documents.
43
43
  #
44
44
  # The short X.Y version.
45
- version = '3.19'
45
+ version = '3.20'
46
46
  # The full version, including alpha/beta/rc tags.
47
- release = '3.19.3'
47
+ release = '3.20.2'
48
48
 
49
49
  # There are two options for replacing |today|: either, you set today to some
50
50
  # non-false value, then it is used:
@@ -12,7 +12,8 @@ from distutils.errors import CCompilerError, DistutilsExecError, \
12
12
  DistutilsPlatformError
13
13
 
14
14
  IS_PYPY = hasattr(sys, 'pypy_translation_info')
15
- VERSION = '3.19.3'
15
+ IS_GRAALPY = getattr(getattr(sys, "implementation", None), "name", None) == "graalpy"
16
+ VERSION = '3.20.2'
16
17
  DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python"
17
18
 
18
19
  with open('README.rst', 'r') as f:
@@ -124,7 +125,7 @@ def run_setup(with_binary):
124
125
  **kw)
125
126
 
126
127
 
127
- DISABLE_SPEEDUPS = IS_PYPY or os.environ.get('DISABLE_SPEEDUPS') == '1'
128
+ DISABLE_SPEEDUPS = IS_PYPY or IS_GRAALPY or os.environ.get('DISABLE_SPEEDUPS') == '1'
128
129
  CIBUILDWHEEL = os.environ.get('CIBUILDWHEEL') == '1'
129
130
  REQUIRE_SPEEDUPS = CIBUILDWHEEL or os.environ.get('REQUIRE_SPEEDUPS') == '1'
130
131
  try:
@@ -118,7 +118,7 @@ Serializing multiple objects to JSON lines (newline-delimited JSON)::
118
118
 
119
119
  """
120
120
  from __future__ import absolute_import
121
- __version__ = '3.19.3'
121
+ __version__ = '3.20.2'
122
122
  __all__ = [
123
123
  'dump', 'dumps', 'load', 'loads',
124
124
  'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',
@@ -10,11 +10,13 @@
10
10
  #define JSON_UNICHR Py_UCS4
11
11
  #define JSON_InternFromString PyUnicode_InternFromString
12
12
  #define PyString_GET_SIZE PyUnicode_GET_LENGTH
13
+ #define JSON_StringCheck PyUnicode_Check
13
14
  #define PY2_UNUSED
14
15
  #define PY3_UNUSED UNUSED
15
16
  #else /* PY_MAJOR_VERSION >= 3 */
16
17
  #define PY2_UNUSED UNUSED
17
18
  #define PY3_UNUSED
19
+ #define JSON_StringCheck(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
18
20
  #define PyBytes_Check PyString_Check
19
21
  #define PyUnicode_READY(obj) 0
20
22
  #define PyUnicode_KIND(obj) (sizeof(Py_UNICODE))
@@ -3034,25 +3036,29 @@ encoder_listencode_dict(PyEncoderObject *s, JSON_Accu *rval, PyObject *dct, Py_s
3034
3036
  if (value == NULL)
3035
3037
  goto bail;
3036
3038
 
3037
- encoded = PyDict_GetItem(s->key_memo, key);
3038
- if (encoded != NULL) {
3039
- Py_INCREF(encoded);
3040
- } else {
3041
- kstr = encoder_stringify_key(s, key);
3042
- if (kstr == NULL)
3043
- goto bail;
3044
- else if (kstr == Py_None) {
3045
- /* skipkeys */
3046
- Py_DECREF(item);
3047
- Py_DECREF(kstr);
3048
- continue;
3049
- }
3039
+ kstr = encoder_stringify_key(s, key);
3040
+ if (kstr == NULL)
3041
+ goto bail;
3042
+ else if (kstr == Py_None) {
3043
+ /* skipkeys */
3044
+ Py_DECREF(item);
3045
+ Py_DECREF(kstr);
3046
+ continue;
3050
3047
  }
3051
3048
  if (idx) {
3052
3049
  if (JSON_Accu_Accumulate(rval, s->item_separator))
3053
3050
  goto bail;
3054
3051
  }
3055
- if (encoded == NULL) {
3052
+ /*
3053
+ * Only cache the encoding of string keys. False and True are
3054
+ * indistinguishable from 0 and 1 in a dictionary lookup and there
3055
+ * may be other quirks with user defined subclasses.
3056
+ */
3057
+ encoded = PyDict_GetItem(s->key_memo, kstr);
3058
+ if (encoded != NULL) {
3059
+ Py_INCREF(encoded);
3060
+ Py_CLEAR(kstr);
3061
+ } else {
3056
3062
  encoded = encoder_encode_string(s, kstr);
3057
3063
  Py_CLEAR(kstr);
3058
3064
  if (encoded == NULL)
@@ -18,6 +18,8 @@ class TestMissingSpeedups(unittest.TestCase):
18
18
  def runTest(self):
19
19
  if hasattr(sys, "pypy_translation_info"):
20
20
  "PyPy doesn't need speedups! :)"
21
+ elif getattr(getattr(sys, "implementation", None), "name", None) == "graalpy":
22
+ "GraalPy doesn't need speedups! :)"
21
23
  elif hasattr(self, "skipTest"):
22
24
  self.skipTest("_speedups.so is missing!")
23
25
 
@@ -72,6 +72,12 @@ class TestDump(TestCase):
72
72
  self.assertEqual(json.dumps(
73
73
  {True: False, False: True}, sort_keys=True),
74
74
  '{"false": true, "true": false}')
75
+ self.assertEqual(
76
+ # load first because the keys are not sorted
77
+ json.loads(json.dumps({'k1': {False: 5}, 'k2': {0: 5}})),
78
+ {'k1': {'false': 5}, 'k2': {'0': 5}},
79
+ )
80
+
75
81
  self.assertEqual(
76
82
  json.dumps(
77
83
  {2: 3.0,
@@ -1,3 +1,4 @@
1
+ import sys
1
2
  import math
2
3
  from unittest import TestCase
3
4
  from simplejson.compat import long_type, text_type
@@ -36,3 +37,10 @@ class TestFloat(TestCase):
36
37
  self.assertEqual(int(json.dumps(num)), num)
37
38
  self.assertEqual(json.loads(json.dumps(num)), num)
38
39
  self.assertEqual(json.loads(text_type(json.dumps(num))), num)
40
+
41
+ def test_float_range(self):
42
+ try:
43
+ float_range = [sys.float_info.min, sys.float_info.max]
44
+ except AttributeError:
45
+ float_range = [2.2250738585072014e-308, 1.7976931348623157e+308]
46
+ self.assertEqual(json.loads(json.dumps(float_range)), float_range)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: simplejson
3
- Version: 3.19.3
3
+ Version: 3.20.2
4
4
  Summary: Simple, fast, extensible JSON encoder/decoder for Python
5
5
  Home-page: https://github.com/simplejson/simplejson
6
6
  Author: Bob Ippolito
@@ -33,6 +33,16 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
33
33
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
34
34
  Requires-Python: >=2.5, !=3.0.*, !=3.1.*, !=3.2.*
35
35
  License-File: LICENSE.txt
36
+ Dynamic: author
37
+ Dynamic: author-email
38
+ Dynamic: classifier
39
+ Dynamic: description
40
+ Dynamic: home-page
41
+ Dynamic: license
42
+ Dynamic: license-file
43
+ Dynamic: platform
44
+ Dynamic: requires-python
45
+ Dynamic: summary
36
46
 
37
47
  simplejson
38
48
  ----------
File without changes
File without changes
File without changes
File without changes
File without changes