simplejson 3.19.2__tar.gz → 3.20.1__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.2 → simplejson-3.20.1}/CHANGES.txt +11 -0
  2. {simplejson-3.19.2/simplejson.egg-info → simplejson-3.20.1}/PKG-INFO +12 -2
  3. {simplejson-3.19.2 → simplejson-3.20.1}/conf.py +3 -3
  4. {simplejson-3.19.2 → simplejson-3.20.1}/index.rst +0 -7
  5. {simplejson-3.19.2 → simplejson-3.20.1}/setup.py +2 -1
  6. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/__init__.py +1 -1
  7. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/_speedups.c +20 -14
  8. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_dump.py +6 -0
  9. {simplejson-3.19.2 → simplejson-3.20.1/simplejson.egg-info}/PKG-INFO +12 -2
  10. {simplejson-3.19.2 → simplejson-3.20.1}/LICENSE.txt +0 -0
  11. {simplejson-3.19.2 → simplejson-3.20.1}/MANIFEST.in +0 -0
  12. {simplejson-3.19.2 → simplejson-3.20.1}/README.rst +0 -0
  13. {simplejson-3.19.2 → simplejson-3.20.1}/scripts/make_docs.py +0 -0
  14. {simplejson-3.19.2 → simplejson-3.20.1}/setup.cfg +0 -0
  15. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/compat.py +0 -0
  16. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/decoder.py +0 -0
  17. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/encoder.py +0 -0
  18. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/errors.py +0 -0
  19. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/ordered_dict.py +0 -0
  20. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/raw_json.py +0 -0
  21. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/scanner.py +0 -0
  22. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/__init__.py +0 -0
  23. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/_cibw_runner.py +0 -0
  24. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_bigint_as_string.py +0 -0
  25. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_bitsize_int_as_string.py +0 -0
  26. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_check_circular.py +0 -0
  27. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_decimal.py +0 -0
  28. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_decode.py +0 -0
  29. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_default.py +0 -0
  30. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_encode_basestring_ascii.py +0 -0
  31. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_encode_for_html.py +0 -0
  32. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_errors.py +0 -0
  33. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_fail.py +0 -0
  34. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_float.py +0 -0
  35. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_for_json.py +0 -0
  36. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_indent.py +0 -0
  37. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_item_sort_key.py +0 -0
  38. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_iterable.py +0 -0
  39. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_namedtuple.py +0 -0
  40. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_pass1.py +0 -0
  41. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_pass2.py +0 -0
  42. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_pass3.py +0 -0
  43. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_raw_json.py +0 -0
  44. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_recursion.py +0 -0
  45. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_scanstring.py +0 -0
  46. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_separators.py +0 -0
  47. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_speedups.py +0 -0
  48. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_str_subclass.py +0 -0
  49. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_subclass.py +0 -0
  50. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_tool.py +0 -0
  51. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_tuple.py +0 -0
  52. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tests/test_unicode.py +0 -0
  53. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson/tool.py +0 -0
  54. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson.egg-info/SOURCES.txt +0 -0
  55. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson.egg-info/dependency_links.txt +0 -0
  56. {simplejson-3.19.2 → simplejson-3.20.1}/simplejson.egg-info/top_level.txt +0 -0
@@ -1,3 +1,14 @@
1
+ Version 3.20.1 released 2025-02-14
2
+
3
+ * Do not memoize keys before they are coerced to string
4
+ https://github.com/simplejson/simplejson/pull/329
5
+
6
+ Version 3.19.3 released 2024-08-14
7
+
8
+ * Updated test & build matrix to include Python 3.13.
9
+ Dropped wheel support for Python 2.7 on macOS.
10
+ https://github.com/simplejson/simplejson/pull/326
11
+
1
12
  Version 3.19.2 released 2023-10-05
2
13
 
3
14
  * Updated test & build matrix to include Python 3.12 and use
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: simplejson
3
- Version: 3.19.2
3
+ Version: 3.20.1
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
@@ -27,11 +27,21 @@ Classifier: Programming Language :: Python :: 3.9
27
27
  Classifier: Programming Language :: Python :: 3.10
28
28
  Classifier: Programming Language :: Python :: 3.11
29
29
  Classifier: Programming Language :: Python :: 3.12
30
+ Classifier: Programming Language :: Python :: 3.13
30
31
  Classifier: Programming Language :: Python :: Implementation :: CPython
31
32
  Classifier: Programming Language :: Python :: Implementation :: PyPy
32
33
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
33
34
  Requires-Python: >=2.5, !=3.0.*, !=3.1.*, !=3.2.*
34
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: platform
43
+ Dynamic: requires-python
44
+ Dynamic: summary
35
45
 
36
46
  simplejson
37
47
  ----------
@@ -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.2'
47
+ release = '3.20.1'
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:
@@ -148,13 +148,6 @@ Serializing multiple objects to JSON lines (newline-delimited JSON)::
148
148
  >>> ''.join(dumps_lines([{'count': 1}, {'count': 2}, {'count': 3}]))
149
149
  '{"count":1}\n{"count":2}\n{"count":3}\n'
150
150
 
151
- .. note::
152
-
153
- JSON is a subset of `YAML <http://yaml.org/>`_ 1.2. The JSON produced by
154
- this module's default settings (in particular, the default *separators*
155
- value) is also a subset of YAML 1.0 and 1.1. This module can thus also be
156
- used as a YAML serializer.
157
-
158
151
 
159
152
  Basic Usage
160
153
  -----------
@@ -12,7 +12,7 @@ from distutils.errors import CCompilerError, DistutilsExecError, \
12
12
  DistutilsPlatformError
13
13
 
14
14
  IS_PYPY = hasattr(sys, 'pypy_translation_info')
15
- VERSION = '3.19.2'
15
+ VERSION = '3.20.1'
16
16
  DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python"
17
17
 
18
18
  with open('README.rst', 'r') as f:
@@ -41,6 +41,7 @@ CLASSIFIERS = [
41
41
  'Programming Language :: Python :: 3.10',
42
42
  'Programming Language :: Python :: 3.11',
43
43
  'Programming Language :: Python :: 3.12',
44
+ 'Programming Language :: Python :: 3.13',
44
45
  'Programming Language :: Python :: Implementation :: CPython',
45
46
  'Programming Language :: Python :: Implementation :: PyPy',
46
47
  'Topic :: Software Development :: Libraries :: Python Modules',
@@ -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.2'
121
+ __version__ = '3.20.1'
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)
@@ -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,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: simplejson
3
- Version: 3.19.2
3
+ Version: 3.20.1
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
@@ -27,11 +27,21 @@ Classifier: Programming Language :: Python :: 3.9
27
27
  Classifier: Programming Language :: Python :: 3.10
28
28
  Classifier: Programming Language :: Python :: 3.11
29
29
  Classifier: Programming Language :: Python :: 3.12
30
+ Classifier: Programming Language :: Python :: 3.13
30
31
  Classifier: Programming Language :: Python :: Implementation :: CPython
31
32
  Classifier: Programming Language :: Python :: Implementation :: PyPy
32
33
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
33
34
  Requires-Python: >=2.5, !=3.0.*, !=3.1.*, !=3.2.*
34
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: platform
43
+ Dynamic: requires-python
44
+ Dynamic: summary
35
45
 
36
46
  simplejson
37
47
  ----------
File without changes
File without changes
File without changes
File without changes