simplejson 3.20.2__tar.gz → 4.1.0__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 (64) hide show
  1. {simplejson-3.20.2 → simplejson-4.1.0}/CHANGES.txt +169 -1
  2. {simplejson-3.20.2 → simplejson-4.1.0}/MANIFEST.in +2 -0
  3. {simplejson-3.20.2/simplejson.egg-info → simplejson-4.1.0}/PKG-INFO +36 -16
  4. {simplejson-3.20.2 → simplejson-4.1.0}/README.rst +30 -4
  5. {simplejson-3.20.2 → simplejson-4.1.0}/conf.py +2 -2
  6. {simplejson-3.20.2 → simplejson-4.1.0}/index.rst +2 -2
  7. simplejson-4.1.0/pyproject.toml +3 -0
  8. {simplejson-3.20.2 → simplejson-4.1.0}/setup.py +14 -24
  9. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/__init__.py +15 -7
  10. simplejson-4.1.0/simplejson/_speedups.c +4040 -0
  11. simplejson-4.1.0/simplejson/_speedups_scan.h +564 -0
  12. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/compat.py +2 -4
  13. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/decoder.py +20 -10
  14. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/encoder.py +130 -93
  15. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/scanner.py +4 -2
  16. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/__init__.py +12 -8
  17. simplejson-4.1.0/simplejson/tests/_helpers.py +17 -0
  18. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_bitsize_int_as_string.py +47 -0
  19. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_check_circular.py +20 -0
  20. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_decode.py +56 -4
  21. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_dump.py +198 -0
  22. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_errors.py +40 -0
  23. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_for_json.py +31 -0
  24. simplejson-4.1.0/simplejson/tests/test_free_threading.py +100 -0
  25. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_iterable.py +30 -0
  26. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_namedtuple.py +55 -23
  27. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_scanstring.py +92 -0
  28. simplejson-4.1.0/simplejson/tests/test_speedups.py +329 -0
  29. simplejson-4.1.0/simplejson/tests/test_subinterpreters.py +125 -0
  30. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_tool.py +9 -22
  31. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tool.py +0 -1
  32. {simplejson-3.20.2 → simplejson-4.1.0/simplejson.egg-info}/PKG-INFO +36 -16
  33. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson.egg-info/SOURCES.txt +6 -0
  34. simplejson-4.1.0/tsan_stress_simplejson.py +506 -0
  35. simplejson-3.20.2/simplejson/_speedups.c +0 -3414
  36. simplejson-3.20.2/simplejson/tests/test_speedups.py +0 -114
  37. {simplejson-3.20.2 → simplejson-4.1.0}/LICENSE.txt +0 -0
  38. {simplejson-3.20.2 → simplejson-4.1.0}/scripts/make_docs.py +0 -0
  39. {simplejson-3.20.2 → simplejson-4.1.0}/setup.cfg +0 -0
  40. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/errors.py +0 -0
  41. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/ordered_dict.py +0 -0
  42. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/raw_json.py +0 -0
  43. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/_cibw_runner.py +0 -0
  44. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_bigint_as_string.py +0 -0
  45. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_decimal.py +0 -0
  46. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_default.py +0 -0
  47. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_encode_basestring_ascii.py +0 -0
  48. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_encode_for_html.py +0 -0
  49. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_fail.py +0 -0
  50. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_float.py +0 -0
  51. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_indent.py +0 -0
  52. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_item_sort_key.py +0 -0
  53. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_pass1.py +0 -0
  54. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_pass2.py +0 -0
  55. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_pass3.py +0 -0
  56. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_raw_json.py +0 -0
  57. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_recursion.py +0 -0
  58. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_separators.py +0 -0
  59. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_str_subclass.py +0 -0
  60. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_subclass.py +0 -0
  61. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_tuple.py +0 -0
  62. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson/tests/test_unicode.py +0 -0
  63. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson.egg-info/dependency_links.txt +0 -0
  64. {simplejson-3.20.2 → simplejson-4.1.0}/simplejson.egg-info/top_level.txt +0 -0
@@ -1,6 +1,174 @@
1
+ Version 4.1.0 released 2026-04-22
2
+
3
+ * The C extension now accelerates encoding when ``indent=`` is set.
4
+ Previously the encoder fell back to the pure-Python implementation
5
+ whenever a non-None ``indent`` was passed; now the C encoder emits
6
+ the newline-plus-indent prefix, the level-aware item separator, and
7
+ the closing indent directly. A representative nested-dict workload
8
+ benchmarks about 4-5x faster end-to-end, and the ``indent=0`` and
9
+ empty-container edge cases continue to match the Python output
10
+ byte-for-byte.
11
+
12
+ * The C extension now emits PEP 678 ``exc.add_note()`` annotations on
13
+ serialization failures, matching the pure-Python encoder. A chained
14
+ error on ``{'a': [1, object(), 3]}`` produces the same three notes
15
+ (``when serializing object object``, ``when serializing list item 1``,
16
+ ``when serializing dict item 'a'``) whether the speedups are loaded
17
+ or not, so the add_note assertions in ``test_errors.py`` no longer
18
+ need ``indent=2`` to force the Python path.
19
+
20
+ Version 4.0.1 released 2026-04-18
21
+
22
+ * Skip uploading Pyodide/wasm wheels to PyPI, which rejects them with
23
+ "unsupported platform tag 'pyodide_2024_0_wasm32'". The wheels are
24
+ still built in CI and preserved as workflow artifacts.
25
+ https://github.com/simplejson/simplejson/pull/375
26
+
27
+ Version 4.0.0 released 2026-04-18
28
+
29
+ * simplejson 4 requires Python 2.7 or Python 3.8+. Older Python
30
+ versions (2.5, 2.6, 3.0-3.7) are no longer supported. pip will
31
+ not install simplejson 4 on unsupported versions.
32
+
33
+ * The C extension now uses heap types and per-module state instead of
34
+ static types and global state. This is required for free-threading
35
+ support and sub-interpreter isolation. The Python-level API is
36
+ unchanged.
37
+
38
+ * Full support for Python 3.13+ free-threading (PEP 703). The C
39
+ extension is now safe to use with the GIL disabled (python3.14t):
40
+ - Converted all static types to heap types with per-module state
41
+ - Added per-object critical sections to scanner and encoder
42
+ - Added free-threading-safe dict operations for Python 3.13+
43
+ - Unified per-module state management and templated parser
44
+ https://github.com/simplejson/simplejson/pull/363
45
+ https://github.com/simplejson/simplejson/pull/364
46
+ https://github.com/simplejson/simplejson/pull/365
47
+ https://github.com/simplejson/simplejson/pull/367
48
+ https://github.com/simplejson/simplejson/pull/369
49
+
50
+ * Numerous C extension memory safety fixes:
51
+ - Fix use-after-free and leak in encoder ident handling
52
+ - Fix NULL dereferences on OOM in module init and static string init
53
+ - Fix reference leaks in dict encoder (skipkeys item, variable shadowing)
54
+ - Fix member table copy-paste, exception clobbering, missing Py_VISIT
55
+ - Fix error-as-truthy bugs in maybe_quote_bigint and is_raw_json
56
+ - Fix iterable_as_array swallowing MemoryError and KeyboardInterrupt
57
+ - Fix for_json and _asdict swallowing MemoryError, KeyboardInterrupt,
58
+ and other non-AttributeError exceptions raised by user __getattr__
59
+ https://github.com/simplejson/simplejson/pull/355
60
+ https://github.com/simplejson/simplejson/pull/356
61
+ https://github.com/simplejson/simplejson/pull/357
62
+ https://github.com/simplejson/simplejson/pull/358
63
+ https://github.com/simplejson/simplejson/pull/359
64
+ https://github.com/simplejson/simplejson/pull/360
65
+ https://github.com/simplejson/simplejson/pull/373
66
+
67
+ * C/Python parity fixes:
68
+ - Fix C scanstring off-by-one bounds checks that caused truncated
69
+ or boundary \uXXXX escapes to raise "Invalid \\uXXXX escape
70
+ sequence" instead of "Unterminated string", and report error
71
+ position at the 'u' instead of the leading backslash. The C and
72
+ Python decoders now agree on exception class, message, and
73
+ position across all tested edge cases.
74
+ - Align the Python encoder's dispatch order with the C encoder for
75
+ objects that define _asdict(). Previously a list/tuple/dict
76
+ subclass with an _asdict() method encoded as its container type
77
+ under the Python encoder and as the _asdict() return value under
78
+ the C encoder; both now check _asdict() before list/tuple/dict.
79
+ for_json() continues to outrank _asdict() in both.
80
+ - Fix C scanstring raising a plain ValueError ("end is out of
81
+ bounds") instead of JSONDecodeError for out-of-range end indices.
82
+ User code with `except JSONDecodeError:` now catches both the
83
+ C and pure-Python paths consistently.
84
+ https://github.com/simplejson/simplejson/pull/372
85
+
86
+ * C extension performance and correctness improvements:
87
+ - Add PyDict_Next fast path for unsorted exact-dict encoding,
88
+ avoiding intermediate items list and N tuple allocations
89
+ - Add indexed fast path for exact list/tuple encoding, avoiding
90
+ iterator allocation and per-item PyIter_Next overhead
91
+ - Use PyUnicodeWriter as JSON_Accu backend on Python 3.14+,
92
+ eliminating intermediate string objects and ''.join calls
93
+ - Fix integer overflow in ascii_escape output_size calculation
94
+ that could cause buffer overwrite on pathologically large strings
95
+ - Fix list encoder separator counter overflow (int to Py_ssize_t)
96
+ - Dead code cleanup (unreachable NULL checks, do-while wrappers)
97
+ https://github.com/simplejson/simplejson/pull/370
98
+
99
+ * Added Python 3.14 support and updated to cibuildwheel 3.2.1. CI now
100
+ tests free-threaded (3.14t) and debug builds with -Werror, refcount
101
+ leak detection, and GIL-disabled mode.
102
+ https://github.com/simplejson/simplejson/pull/343
103
+
104
+ * Added a ThreadSanitizer (TSan) stress test CI job. Builds a
105
+ TSan-instrumented free-threaded CPython (cached between runs) and
106
+ runs a concurrent stress test script against the C extension to
107
+ catch data races under free-threading.
108
+ https://github.com/simplejson/simplejson/pull/373
109
+
110
+ * Replace deprecated license classifiers with SPDX license expression
111
+ https://github.com/simplejson/simplejson/pull/347
112
+
113
+ * Documented RawJSON usage with examples and caveats
114
+ https://github.com/simplejson/simplejson/pull/346
115
+
116
+ * Added pyproject.toml for PEP 517 build support. setup.py is retained
117
+ for Python 2.7 wheel builds and backwards compatibility.
118
+
119
+ * Migrated build_ext import from distutils to setuptools in setup.py.
120
+ The distutils.errors imports are kept since setuptools vendors
121
+ distutils on Python 3.12+ where stdlib distutils was removed.
122
+
123
+ * CI now tests PEP 517 builds (pyproject.toml) alongside the existing
124
+ setup.py-based builds.
125
+
126
+ * Added Pyodide (wasm32) wheel builds with C speedups via cibuildwheel.
127
+ Previously Pyodide users fell back to the pure-Python wheel; now they
128
+ get the compiled C extension cross-compiled to WebAssembly. Thread
129
+ and subprocess tests are skipped on Emscripten where those APIs are
130
+ unavailable.
131
+
132
+ * Test suite now fails (instead of skipping) when C speedups are missing
133
+ during cibuildwheel runs, catching broken extension builds early.
134
+
135
+ * New ``array_hook`` parameter for ``loads()``, ``load()``, and
136
+ ``JSONDecoder``. Called with each decoded JSON array (as a list),
137
+ its return value replaces the list. Analogous to ``object_hook``
138
+ for dicts. Works with both the Python decoder and C scanner.
139
+ (Matches CPython 3.15 json module.)
140
+
141
+ * Trailing comma detection: the decoder now raises ``JSONDecodeError``
142
+ with "Illegal trailing comma before end of object/array" for inputs
143
+ like ``[1,]`` and ``{"a": 1,}`` instead of generic error messages.
144
+ Both the Python decoder and C scanner are updated.
145
+ (Matches CPython 3.13+ json module.)
146
+
147
+ * ``frozendict`` encoding support: when ``frozendict`` is available
148
+ (CPython 3.15+ PEP 814), it is encoded as a JSON object just like
149
+ ``dict``. No effect on older Python versions.
150
+
151
+ * Serialization errors now include ``add_note()`` context on Python
152
+ 3.11+ (PEP 678), annotating exceptions with the path to the error,
153
+ e.g. "when serializing list item 1" / "when serializing dict item
154
+ 'key'". Only applies to the Python encoder.
155
+
156
+ * New C fast path for ``encode_basestring`` (``ensure_ascii=False``).
157
+ Previously the non-ASCII string encoder fell back to pure Python;
158
+ now it has a C implementation matching the existing
159
+ ``encode_basestring_ascii`` fast path.
160
+ https://github.com/simplejson/simplejson/issues/207
161
+
162
+ * The Python decoder now rejects non-ASCII digits (e.g. fullwidth
163
+ ``\uff10``) in JSON numbers, matching the C scanner behavior.
164
+ The ``NUMBER_RE`` regex was changed from ``\d`` to ``[0-9]``.
165
+
166
+ * Removed dead single-phase init code for Python 3.3/3.4 from the
167
+ C extension (these versions are no longer supported).
168
+
1
169
  Version 3.20.2 released 2025-09-24
2
170
 
3
- * Disable speedups on GraalPy smae as on PyPy
171
+ * Disable speedups on GraalPy same as on PyPy
4
172
  https://github.com/simplejson/simplejson/pull/339
5
173
 
6
174
  Version 3.20.1 released 2025-02-14
@@ -1,5 +1,7 @@
1
1
  include *.py
2
2
  include *.txt
3
3
  include *.rst
4
+ include *.toml
4
5
  include scripts/*.py
5
6
  include MANIFEST.in
7
+ include simplejson/*.h
@@ -1,37 +1,31 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simplejson
3
- Version: 3.20.2
3
+ Version: 4.1.0
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
7
7
  Author-email: bob@redivi.com
8
- License: MIT License
8
+ License: MIT OR AFL-2.1
9
9
  Platform: any
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: WebAssembly :: Emscripten
11
12
  Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: License :: OSI Approved :: Academic Free License (AFL)
14
13
  Classifier: Programming Language :: Python
15
14
  Classifier: Programming Language :: Python :: 2
16
- Classifier: Programming Language :: Python :: 2.5
17
- Classifier: Programming Language :: Python :: 2.6
18
15
  Classifier: Programming Language :: Python :: 2.7
19
16
  Classifier: Programming Language :: Python :: 3
20
- Classifier: Programming Language :: Python :: 3.3
21
- Classifier: Programming Language :: Python :: 3.4
22
- Classifier: Programming Language :: Python :: 3.5
23
- Classifier: Programming Language :: Python :: 3.6
24
- Classifier: Programming Language :: Python :: 3.7
25
17
  Classifier: Programming Language :: Python :: 3.8
26
18
  Classifier: Programming Language :: Python :: 3.9
27
19
  Classifier: Programming Language :: Python :: 3.10
28
20
  Classifier: Programming Language :: Python :: 3.11
29
21
  Classifier: Programming Language :: Python :: 3.12
30
22
  Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
31
24
  Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Programming Language :: Python :: Implementation :: GraalPy
32
26
  Classifier: Programming Language :: Python :: Implementation :: PyPy
33
27
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
34
- Requires-Python: >=2.5, !=3.0.*, !=3.1.*, !=3.2.*
28
+ Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*
35
29
  License-File: LICENSE.txt
36
30
  Dynamic: author
37
31
  Dynamic: author-email
@@ -48,8 +42,8 @@ simplejson
48
42
  ----------
49
43
 
50
44
  simplejson is a simple, fast, complete, correct and extensible
51
- JSON <http://json.org> encoder and decoder for Python 3.3+
52
- with legacy support for Python 2.5+. It is pure Python code
45
+ JSON <http://json.org> encoder and decoder for Python 3.8+
46
+ with legacy support for Python 2.7. It is pure Python code
53
47
  with no dependencies, but includes an optional C extension
54
48
  for a serious speed boost.
55
49
 
@@ -58,8 +52,9 @@ https://simplejson.readthedocs.io/
58
52
 
59
53
  simplejson is the externally maintained development version of the
60
54
  json library included with Python (since 2.6). This version is tested
61
- with the latest Python 3.8 and maintains backwards compatibility
62
- with Python 3.3+ and the legacy Python 2.5 - Python 2.7 releases.
55
+ with Python 3.14 (including free-threaded builds) and maintains
56
+ backwards compatibility with Python 3.8+. A legacy Python 2.7 wheel
57
+ is also published.
63
58
 
64
59
  The encoder can be specialized to provide serialization in any kind of
65
60
  situation, without any special support by the objects to be serialized
@@ -78,3 +73,28 @@ Python 2.2. This is based on a very old version of simplejson,
78
73
  is not maintained, and should only be used as a last resort.
79
74
 
80
75
  .. _python2.2: https://github.com/simplejson/simplejson/tree/python2.2
76
+
77
+ RawJSON
78
+ ~~~~~~~
79
+
80
+ ``RawJSON`` allows embedding pre-encoded JSON strings into output without
81
+ re-encoding them.
82
+
83
+ This can be useful in advanced cases where JSON content is already
84
+ serialized and re-encoding would be unnecessary.
85
+
86
+ Example usage::
87
+
88
+ from simplejson import dumps, RawJSON
89
+
90
+ payload = {
91
+ "status": "ok",
92
+ "data": RawJSON('{"a": 1, "b": 2}')
93
+ }
94
+
95
+ print(dumps(payload))
96
+ # Output: {"status": "ok", "data": {"a": 1, "b": 2}}
97
+
98
+ **Caveat:** ``RawJSON`` should be used with care. It bypasses normal
99
+ serialization and validation, and is not recommended for general use
100
+ unless the embedded JSON content is fully trusted.
@@ -2,8 +2,8 @@ simplejson
2
2
  ----------
3
3
 
4
4
  simplejson is a simple, fast, complete, correct and extensible
5
- JSON <http://json.org> encoder and decoder for Python 3.3+
6
- with legacy support for Python 2.5+. It is pure Python code
5
+ JSON <http://json.org> encoder and decoder for Python 3.8+
6
+ with legacy support for Python 2.7. It is pure Python code
7
7
  with no dependencies, but includes an optional C extension
8
8
  for a serious speed boost.
9
9
 
@@ -12,8 +12,9 @@ https://simplejson.readthedocs.io/
12
12
 
13
13
  simplejson is the externally maintained development version of the
14
14
  json library included with Python (since 2.6). This version is tested
15
- with the latest Python 3.8 and maintains backwards compatibility
16
- with Python 3.3+ and the legacy Python 2.5 - Python 2.7 releases.
15
+ with Python 3.14 (including free-threaded builds) and maintains
16
+ backwards compatibility with Python 3.8+. A legacy Python 2.7 wheel
17
+ is also published.
17
18
 
18
19
  The encoder can be specialized to provide serialization in any kind of
19
20
  situation, without any special support by the objects to be serialized
@@ -32,3 +33,28 @@ Python 2.2. This is based on a very old version of simplejson,
32
33
  is not maintained, and should only be used as a last resort.
33
34
 
34
35
  .. _python2.2: https://github.com/simplejson/simplejson/tree/python2.2
36
+
37
+ RawJSON
38
+ ~~~~~~~
39
+
40
+ ``RawJSON`` allows embedding pre-encoded JSON strings into output without
41
+ re-encoding them.
42
+
43
+ This can be useful in advanced cases where JSON content is already
44
+ serialized and re-encoding would be unnecessary.
45
+
46
+ Example usage::
47
+
48
+ from simplejson import dumps, RawJSON
49
+
50
+ payload = {
51
+ "status": "ok",
52
+ "data": RawJSON('{"a": 1, "b": 2}')
53
+ }
54
+
55
+ print(dumps(payload))
56
+ # Output: {"status": "ok", "data": {"a": 1, "b": 2}}
57
+
58
+ **Caveat:** ``RawJSON`` should be used with care. It bypasses normal
59
+ serialization and validation, and is not recommended for general use
60
+ unless the embedded JSON content is fully trusted.
@@ -42,9 +42,9 @@ copyright = '2025, Bob Ippolito'
42
42
  # other places throughout the built documents.
43
43
  #
44
44
  # The short X.Y version.
45
- version = '3.20'
45
+ version = '4.1'
46
46
  # The full version, including alpha/beta/rc tags.
47
- release = '3.20.2'
47
+ release = '4.1.0'
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:
@@ -21,8 +21,8 @@ for a serious speed boost.
21
21
  :mod:`simplejson` exposes an API familiar to users of the standard library
22
22
  :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
23
23
  version of the :mod:`json` library, but maintains
24
- compatibility with the latest Python 3.8+ releases back to Python 3.3
25
- as well as the legacy Python 2.5 - Python 2.7 releases.
24
+ compatibility with Python 3.8 through 3.14 (including free-threaded
25
+ builds) as well as legacy Python 2.7.
26
26
 
27
27
  Development of simplejson happens on Github:
28
28
  http://github.com/simplejson/simplejson
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
@@ -1,61 +1,47 @@
1
1
  #!/usr/bin/env python
2
- from __future__ import with_statement
3
-
4
2
  import os
5
3
  import sys
6
4
  try:
7
5
  from setuptools import setup, Extension, Command
6
+ from setuptools.command.build_ext import build_ext
8
7
  except ImportError:
9
8
  from distutils.core import setup, Extension, Command
10
- from distutils.command.build_ext import build_ext
9
+ from distutils.command.build_ext import build_ext
11
10
  from distutils.errors import CCompilerError, DistutilsExecError, \
12
11
  DistutilsPlatformError
13
12
 
14
13
  IS_PYPY = hasattr(sys, 'pypy_translation_info')
15
14
  IS_GRAALPY = getattr(getattr(sys, "implementation", None), "name", None) == "graalpy"
16
- VERSION = '3.20.2'
15
+ VERSION = '4.1.0'
17
16
  DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python"
18
17
 
19
18
  with open('README.rst', 'r') as f:
20
19
  LONG_DESCRIPTION = f.read()
21
20
 
22
- PYTHON_REQUIRES = '>=2.5, !=3.0.*, !=3.1.*, !=3.2.*'
21
+ PYTHON_REQUIRES = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*'
23
22
 
24
23
  CLASSIFIERS = [
25
24
  'Development Status :: 5 - Production/Stable',
25
+ 'Environment :: WebAssembly :: Emscripten',
26
26
  'Intended Audience :: Developers',
27
- 'License :: OSI Approved :: MIT License',
28
- 'License :: OSI Approved :: Academic Free License (AFL)',
29
27
  'Programming Language :: Python',
30
28
  'Programming Language :: Python :: 2',
31
- 'Programming Language :: Python :: 2.5',
32
- 'Programming Language :: Python :: 2.6',
33
29
  'Programming Language :: Python :: 2.7',
34
30
  'Programming Language :: Python :: 3',
35
- 'Programming Language :: Python :: 3.3',
36
- 'Programming Language :: Python :: 3.4',
37
- 'Programming Language :: Python :: 3.5',
38
- 'Programming Language :: Python :: 3.6',
39
- 'Programming Language :: Python :: 3.7',
40
31
  'Programming Language :: Python :: 3.8',
41
32
  'Programming Language :: Python :: 3.9',
42
33
  'Programming Language :: Python :: 3.10',
43
34
  'Programming Language :: Python :: 3.11',
44
35
  'Programming Language :: Python :: 3.12',
45
36
  'Programming Language :: Python :: 3.13',
37
+ 'Programming Language :: Python :: 3.14',
46
38
  'Programming Language :: Python :: Implementation :: CPython',
39
+ 'Programming Language :: Python :: Implementation :: GraalPy',
47
40
  'Programming Language :: Python :: Implementation :: PyPy',
48
41
  'Topic :: Software Development :: Libraries :: Python Modules',
49
42
  ]
50
43
 
51
- if sys.platform == 'win32' and sys.version_info < (2, 7):
52
- # 2.6's distutils.msvc9compiler can raise an IOError when failing to
53
- # find the compiler
54
- # It can also raise ValueError https://bugs.python.org/issue7511
55
- ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError,
56
- IOError, ValueError)
57
- else:
58
- ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
44
+ ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
59
45
 
60
46
 
61
47
  class BuildFailed(Exception):
@@ -102,7 +88,11 @@ def run_setup(with_binary):
102
88
  if with_binary:
103
89
  kw = dict(
104
90
  ext_modules=[
105
- Extension("simplejson._speedups", ["simplejson/_speedups.c"]),
91
+ Extension(
92
+ "simplejson._speedups",
93
+ sources=["simplejson/_speedups.c"],
94
+ depends=["simplejson/_speedups_scan.h"],
95
+ ),
106
96
  ],
107
97
  cmdclass=dict(cmdclass, build_ext=ve_build_ext),
108
98
  )
@@ -119,7 +109,7 @@ def run_setup(with_binary):
119
109
  author="Bob Ippolito",
120
110
  author_email="bob@redivi.com",
121
111
  url="https://github.com/simplejson/simplejson",
122
- license="MIT License",
112
+ license="MIT OR AFL-2.1",
123
113
  packages=['simplejson', 'simplejson.tests'],
124
114
  platforms=['any'],
125
115
  **kw)
@@ -4,9 +4,9 @@ interchange format.
4
4
 
5
5
  :mod:`simplejson` exposes an API familiar to users of the standard library
6
6
  :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
7
- version of the :mod:`json` library contained in Python 2.6, but maintains
8
- compatibility back to Python 2.5 and (currently) has significant performance
9
- advantages, even without using the optional C extension for speedups.
7
+ version of the :mod:`json` library contained in Python 2.6+, supporting
8
+ Python 2.7 and Python 3.8+, and has significant performance advantages,
9
+ even without using the optional C extension for speedups.
10
10
 
11
11
  Encoding basic Python object hierarchies::
12
12
 
@@ -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.20.2'
121
+ __version__ = '4.1.0'
122
122
  __all__ = [
123
123
  'dump', 'dumps', 'load', 'loads',
124
124
  'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',
@@ -133,6 +133,7 @@ from .errors import JSONDecodeError
133
133
  from .raw_json import RawJSON
134
134
  from .decoder import JSONDecoder
135
135
  from .encoder import JSONEncoder, JSONEncoderForHTML
136
+
136
137
  def _import_OrderedDict():
137
138
  import collections
138
139
  try:
@@ -400,7 +401,7 @@ _default_decoder = JSONDecoder()
400
401
 
401
402
  def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
402
403
  parse_int=None, parse_constant=None, object_pairs_hook=None,
403
- use_decimal=False, allow_nan=False, **kw):
404
+ use_decimal=False, allow_nan=False, array_hook=None, **kw):
404
405
  """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
405
406
  a JSON document as `str` or `bytes`) to a Python object.
406
407
 
@@ -453,12 +454,13 @@ def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
453
454
  encoding=encoding, cls=cls, object_hook=object_hook,
454
455
  parse_float=parse_float, parse_int=parse_int,
455
456
  parse_constant=parse_constant, object_pairs_hook=object_pairs_hook,
456
- use_decimal=use_decimal, allow_nan=allow_nan, **kw)
457
+ use_decimal=use_decimal, allow_nan=allow_nan,
458
+ array_hook=array_hook, **kw)
457
459
 
458
460
 
459
461
  def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
460
462
  parse_int=None, parse_constant=None, object_pairs_hook=None,
461
- use_decimal=False, allow_nan=False, **kw):
463
+ use_decimal=False, allow_nan=False, array_hook=None, **kw):
462
464
  """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
463
465
  document) to a Python object.
464
466
 
@@ -510,6 +512,7 @@ def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
510
512
  if (cls is None and encoding is None and object_hook is None and
511
513
  parse_int is None and parse_float is None and
512
514
  parse_constant is None and object_pairs_hook is None
515
+ and array_hook is None
513
516
  and not use_decimal and not allow_nan and not kw):
514
517
  return _default_decoder.decode(s)
515
518
  if cls is None:
@@ -518,6 +521,8 @@ def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
518
521
  kw['object_hook'] = object_hook
519
522
  if object_pairs_hook is not None:
520
523
  kw['object_pairs_hook'] = object_pairs_hook
524
+ if array_hook is not None:
525
+ kw['array_hook'] = array_hook
521
526
  if parse_float is not None:
522
527
  kw['parse_float'] = parse_float
523
528
  if parse_int is not None:
@@ -543,11 +548,14 @@ def _toggle_speedups(enabled):
543
548
  enc.c_make_encoder = c_make_encoder
544
549
  enc.encode_basestring_ascii = (enc.c_encode_basestring_ascii or
545
550
  enc.py_encode_basestring_ascii)
551
+ enc.encode_basestring = (enc.c_encode_basestring or
552
+ enc.py_encode_basestring)
546
553
  scan.make_scanner = scan.c_make_scanner or scan.py_make_scanner
547
554
  else:
548
555
  dec.scanstring = dec.py_scanstring
549
556
  enc.c_make_encoder = None
550
557
  enc.encode_basestring_ascii = enc.py_encode_basestring_ascii
558
+ enc.encode_basestring = enc.py_encode_basestring
551
559
  scan.make_scanner = scan.py_make_scanner
552
560
  dec.make_scanner = scan.make_scanner
553
561
  global _default_decoder