simplejson 3.20.2__tar.gz → 4.0.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 (64) hide show
  1. {simplejson-3.20.2 → simplejson-4.0.1}/CHANGES.txt +150 -1
  2. {simplejson-3.20.2 → simplejson-4.0.1}/MANIFEST.in +2 -0
  3. {simplejson-3.20.2/simplejson.egg-info → simplejson-4.0.1}/PKG-INFO +36 -16
  4. {simplejson-3.20.2 → simplejson-4.0.1}/README.rst +30 -4
  5. {simplejson-3.20.2 → simplejson-4.0.1}/conf.py +2 -2
  6. {simplejson-3.20.2 → simplejson-4.0.1}/index.rst +2 -2
  7. simplejson-4.0.1/pyproject.toml +3 -0
  8. {simplejson-3.20.2 → simplejson-4.0.1}/setup.py +14 -24
  9. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/__init__.py +15 -7
  10. simplejson-4.0.1/simplejson/_speedups.c +3807 -0
  11. simplejson-4.0.1/simplejson/_speedups_scan.h +564 -0
  12. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/compat.py +2 -4
  13. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/decoder.py +20 -10
  14. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/encoder.py +129 -92
  15. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/scanner.py +4 -2
  16. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/__init__.py +12 -8
  17. simplejson-4.0.1/simplejson/tests/_helpers.py +17 -0
  18. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_bitsize_int_as_string.py +47 -0
  19. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_check_circular.py +20 -0
  20. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_decode.py +56 -4
  21. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_dump.py +198 -0
  22. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_errors.py +41 -0
  23. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_for_json.py +31 -0
  24. simplejson-4.0.1/simplejson/tests/test_free_threading.py +100 -0
  25. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_iterable.py +30 -0
  26. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_namedtuple.py +55 -23
  27. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_scanstring.py +92 -0
  28. simplejson-4.0.1/simplejson/tests/test_speedups.py +329 -0
  29. simplejson-4.0.1/simplejson/tests/test_subinterpreters.py +125 -0
  30. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_tool.py +9 -22
  31. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tool.py +0 -1
  32. {simplejson-3.20.2 → simplejson-4.0.1/simplejson.egg-info}/PKG-INFO +36 -16
  33. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson.egg-info/SOURCES.txt +6 -0
  34. simplejson-4.0.1/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.0.1}/LICENSE.txt +0 -0
  38. {simplejson-3.20.2 → simplejson-4.0.1}/scripts/make_docs.py +0 -0
  39. {simplejson-3.20.2 → simplejson-4.0.1}/setup.cfg +0 -0
  40. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/errors.py +0 -0
  41. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/ordered_dict.py +0 -0
  42. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/raw_json.py +0 -0
  43. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/_cibw_runner.py +0 -0
  44. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_bigint_as_string.py +0 -0
  45. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_decimal.py +0 -0
  46. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_default.py +0 -0
  47. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_encode_basestring_ascii.py +0 -0
  48. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_encode_for_html.py +0 -0
  49. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_fail.py +0 -0
  50. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_float.py +0 -0
  51. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_indent.py +0 -0
  52. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_item_sort_key.py +0 -0
  53. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_pass1.py +0 -0
  54. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_pass2.py +0 -0
  55. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_pass3.py +0 -0
  56. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_raw_json.py +0 -0
  57. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_recursion.py +0 -0
  58. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_separators.py +0 -0
  59. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_str_subclass.py +0 -0
  60. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_subclass.py +0 -0
  61. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_tuple.py +0 -0
  62. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson/tests/test_unicode.py +0 -0
  63. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson.egg-info/dependency_links.txt +0 -0
  64. {simplejson-3.20.2 → simplejson-4.0.1}/simplejson.egg-info/top_level.txt +0 -0
@@ -1,6 +1,155 @@
1
+ Version 4.0.1 released 2026-04-18
2
+
3
+ * Skip uploading Pyodide/wasm wheels to PyPI, which rejects them with
4
+ "unsupported platform tag 'pyodide_2024_0_wasm32'". The wheels are
5
+ still built in CI and preserved as workflow artifacts.
6
+ https://github.com/simplejson/simplejson/pull/375
7
+
8
+ Version 4.0.0 released 2026-04-18
9
+
10
+ * simplejson 4 requires Python 2.7 or Python 3.8+. Older Python
11
+ versions (2.5, 2.6, 3.0-3.7) are no longer supported. pip will
12
+ not install simplejson 4 on unsupported versions.
13
+
14
+ * The C extension now uses heap types and per-module state instead of
15
+ static types and global state. This is required for free-threading
16
+ support and sub-interpreter isolation. The Python-level API is
17
+ unchanged.
18
+
19
+ * Full support for Python 3.13+ free-threading (PEP 703). The C
20
+ extension is now safe to use with the GIL disabled (python3.14t):
21
+ - Converted all static types to heap types with per-module state
22
+ - Added per-object critical sections to scanner and encoder
23
+ - Added free-threading-safe dict operations for Python 3.13+
24
+ - Unified per-module state management and templated parser
25
+ https://github.com/simplejson/simplejson/pull/363
26
+ https://github.com/simplejson/simplejson/pull/364
27
+ https://github.com/simplejson/simplejson/pull/365
28
+ https://github.com/simplejson/simplejson/pull/367
29
+ https://github.com/simplejson/simplejson/pull/369
30
+
31
+ * Numerous C extension memory safety fixes:
32
+ - Fix use-after-free and leak in encoder ident handling
33
+ - Fix NULL dereferences on OOM in module init and static string init
34
+ - Fix reference leaks in dict encoder (skipkeys item, variable shadowing)
35
+ - Fix member table copy-paste, exception clobbering, missing Py_VISIT
36
+ - Fix error-as-truthy bugs in maybe_quote_bigint and is_raw_json
37
+ - Fix iterable_as_array swallowing MemoryError and KeyboardInterrupt
38
+ - Fix for_json and _asdict swallowing MemoryError, KeyboardInterrupt,
39
+ and other non-AttributeError exceptions raised by user __getattr__
40
+ https://github.com/simplejson/simplejson/pull/355
41
+ https://github.com/simplejson/simplejson/pull/356
42
+ https://github.com/simplejson/simplejson/pull/357
43
+ https://github.com/simplejson/simplejson/pull/358
44
+ https://github.com/simplejson/simplejson/pull/359
45
+ https://github.com/simplejson/simplejson/pull/360
46
+ https://github.com/simplejson/simplejson/pull/373
47
+
48
+ * C/Python parity fixes:
49
+ - Fix C scanstring off-by-one bounds checks that caused truncated
50
+ or boundary \uXXXX escapes to raise "Invalid \\uXXXX escape
51
+ sequence" instead of "Unterminated string", and report error
52
+ position at the 'u' instead of the leading backslash. The C and
53
+ Python decoders now agree on exception class, message, and
54
+ position across all tested edge cases.
55
+ - Align the Python encoder's dispatch order with the C encoder for
56
+ objects that define _asdict(). Previously a list/tuple/dict
57
+ subclass with an _asdict() method encoded as its container type
58
+ under the Python encoder and as the _asdict() return value under
59
+ the C encoder; both now check _asdict() before list/tuple/dict.
60
+ for_json() continues to outrank _asdict() in both.
61
+ - Fix C scanstring raising a plain ValueError ("end is out of
62
+ bounds") instead of JSONDecodeError for out-of-range end indices.
63
+ User code with `except JSONDecodeError:` now catches both the
64
+ C and pure-Python paths consistently.
65
+ https://github.com/simplejson/simplejson/pull/372
66
+
67
+ * C extension performance and correctness improvements:
68
+ - Add PyDict_Next fast path for unsorted exact-dict encoding,
69
+ avoiding intermediate items list and N tuple allocations
70
+ - Add indexed fast path for exact list/tuple encoding, avoiding
71
+ iterator allocation and per-item PyIter_Next overhead
72
+ - Use PyUnicodeWriter as JSON_Accu backend on Python 3.14+,
73
+ eliminating intermediate string objects and ''.join calls
74
+ - Fix integer overflow in ascii_escape output_size calculation
75
+ that could cause buffer overwrite on pathologically large strings
76
+ - Fix list encoder separator counter overflow (int to Py_ssize_t)
77
+ - Dead code cleanup (unreachable NULL checks, do-while wrappers)
78
+ https://github.com/simplejson/simplejson/pull/370
79
+
80
+ * Added Python 3.14 support and updated to cibuildwheel 3.2.1. CI now
81
+ tests free-threaded (3.14t) and debug builds with -Werror, refcount
82
+ leak detection, and GIL-disabled mode.
83
+ https://github.com/simplejson/simplejson/pull/343
84
+
85
+ * Added a ThreadSanitizer (TSan) stress test CI job. Builds a
86
+ TSan-instrumented free-threaded CPython (cached between runs) and
87
+ runs a concurrent stress test script against the C extension to
88
+ catch data races under free-threading.
89
+ https://github.com/simplejson/simplejson/pull/373
90
+
91
+ * Replace deprecated license classifiers with SPDX license expression
92
+ https://github.com/simplejson/simplejson/pull/347
93
+
94
+ * Documented RawJSON usage with examples and caveats
95
+ https://github.com/simplejson/simplejson/pull/346
96
+
97
+ * Added pyproject.toml for PEP 517 build support. setup.py is retained
98
+ for Python 2.7 wheel builds and backwards compatibility.
99
+
100
+ * Migrated build_ext import from distutils to setuptools in setup.py.
101
+ The distutils.errors imports are kept since setuptools vendors
102
+ distutils on Python 3.12+ where stdlib distutils was removed.
103
+
104
+ * CI now tests PEP 517 builds (pyproject.toml) alongside the existing
105
+ setup.py-based builds.
106
+
107
+ * Added Pyodide (wasm32) wheel builds with C speedups via cibuildwheel.
108
+ Previously Pyodide users fell back to the pure-Python wheel; now they
109
+ get the compiled C extension cross-compiled to WebAssembly. Thread
110
+ and subprocess tests are skipped on Emscripten where those APIs are
111
+ unavailable.
112
+
113
+ * Test suite now fails (instead of skipping) when C speedups are missing
114
+ during cibuildwheel runs, catching broken extension builds early.
115
+
116
+ * New ``array_hook`` parameter for ``loads()``, ``load()``, and
117
+ ``JSONDecoder``. Called with each decoded JSON array (as a list),
118
+ its return value replaces the list. Analogous to ``object_hook``
119
+ for dicts. Works with both the Python decoder and C scanner.
120
+ (Matches CPython 3.15 json module.)
121
+
122
+ * Trailing comma detection: the decoder now raises ``JSONDecodeError``
123
+ with "Illegal trailing comma before end of object/array" for inputs
124
+ like ``[1,]`` and ``{"a": 1,}`` instead of generic error messages.
125
+ Both the Python decoder and C scanner are updated.
126
+ (Matches CPython 3.13+ json module.)
127
+
128
+ * ``frozendict`` encoding support: when ``frozendict`` is available
129
+ (CPython 3.15+ PEP 814), it is encoded as a JSON object just like
130
+ ``dict``. No effect on older Python versions.
131
+
132
+ * Serialization errors now include ``add_note()`` context on Python
133
+ 3.11+ (PEP 678), annotating exceptions with the path to the error,
134
+ e.g. "when serializing list item 1" / "when serializing dict item
135
+ 'key'". Only applies to the Python encoder.
136
+
137
+ * New C fast path for ``encode_basestring`` (``ensure_ascii=False``).
138
+ Previously the non-ASCII string encoder fell back to pure Python;
139
+ now it has a C implementation matching the existing
140
+ ``encode_basestring_ascii`` fast path.
141
+ https://github.com/simplejson/simplejson/issues/207
142
+
143
+ * The Python decoder now rejects non-ASCII digits (e.g. fullwidth
144
+ ``\uff10``) in JSON numbers, matching the C scanner behavior.
145
+ The ``NUMBER_RE`` regex was changed from ``\d`` to ``[0-9]``.
146
+
147
+ * Removed dead single-phase init code for Python 3.3/3.4 from the
148
+ C extension (these versions are no longer supported).
149
+
1
150
  Version 3.20.2 released 2025-09-24
2
151
 
3
- * Disable speedups on GraalPy smae as on PyPy
152
+ * Disable speedups on GraalPy same as on PyPy
4
153
  https://github.com/simplejson/simplejson/pull/339
5
154
 
6
155
  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.0.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
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.0'
46
46
  # The full version, including alpha/beta/rc tags.
47
- release = '3.20.2'
47
+ release = '4.0.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:
@@ -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.0.1'
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.0.1'
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