python-rapidjson 1.22__tar.gz → 1.24__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.
- {python_rapidjson-1.22 → python_rapidjson-1.24}/CHANGES.rst +30 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/PKG-INFO +31 -4
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/benchmarks-tables.rst +43 -43
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/changes.rst +30 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/python_rapidjson.egg-info/PKG-INFO +31 -4
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson.cpp +31 -33
- {python_rapidjson-1.22 → python_rapidjson-1.24}/requirements-test.txt +5 -4
- {python_rapidjson-1.22 → python_rapidjson-1.24}/requirements.txt +11 -8
- {python_rapidjson-1.22 → python_rapidjson-1.24}/setup.py +5 -23
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_base_types.py +22 -1
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_dict_subclass.py +2 -2
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_memory_leaks.py +29 -1
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_params.py +12 -1
- {python_rapidjson-1.22 → python_rapidjson-1.24}/typings/rapidjson/__init__.pyi +14 -9
- {python_rapidjson-1.22 → python_rapidjson-1.24}/.dir-locals.el +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/LICENSE +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/MANIFEST.in +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/README.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/benchmarks/conftest.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/benchmarks/tablize.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/benchmarks/test_benchmark.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/Makefile +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/api.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/benchmarks.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/conf.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/decoder.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/dump.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/dumps.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/encoder.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/index.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/load.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/loads.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/quickstart.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/rawjson.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/docs/validator.rst +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/python_rapidjson.egg-info/SOURCES.txt +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/python_rapidjson.egg-info/dependency_links.txt +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/python_rapidjson.egg-info/top_level.txt +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/allocators.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/cursorstreamwrapper.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/document.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/encodedstream.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/encodings.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/error/en.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/error/error.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/filereadstream.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/filewritestream.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/fwd.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/biginteger.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/clzll.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/diyfp.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/dtoa.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/ieee754.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/itoa.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/meta.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/pow10.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/regex.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/stack.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/strfunc.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/strtod.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/swap.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/istreamwrapper.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/memorybuffer.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/memorystream.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/msinttypes/inttypes.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/msinttypes/stdint.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/ostreamwrapper.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/pointer.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/prettywriter.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/rapidjson.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/reader.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/schema.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/stream.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/stringbuffer.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/uri.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/writer.h +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/license.txt +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/readme.md +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson_exact_version.txt +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/setup.cfg +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/conftest.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_circular.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_enum.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_float.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_pass1.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_pass2.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_pass3.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_rawjson.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_refs_count.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_streams.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_unicode.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tests/test_validator.py +0 -0
- {python_rapidjson-1.22 → python_rapidjson-1.24}/tox.ini +0 -0
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
Changes
|
|
2
2
|
-------
|
|
3
3
|
|
|
4
|
+
1.24 (2026-09-05)
|
|
5
|
+
~~~~~~~~~~~~~~~~~
|
|
6
|
+
|
|
7
|
+
* Fix error handling after ``PyList_SetItem()`` calls (`issue 231`__)
|
|
8
|
+
|
|
9
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/231
|
|
10
|
+
|
|
11
|
+
* Fix error handling after ``PyList_Append()`` calls (`issue 232`__)
|
|
12
|
+
|
|
13
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/232
|
|
14
|
+
|
|
15
|
+
* Fix crash serializing a list that changes on the fly (`issue 238`__)
|
|
16
|
+
|
|
17
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/238
|
|
18
|
+
|
|
19
|
+
* Fix memory leak in ``RawJSON`` constructor with invalid argument (`PR #239`__), thanks
|
|
20
|
+
to Junhyung Lee
|
|
21
|
+
|
|
22
|
+
__ https://github.com/python-rapidjson/python-rapidjson/pull/239
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
1.23 (2025-12-07)
|
|
26
|
+
~~~~~~~~~~~~~~~~~
|
|
27
|
+
|
|
28
|
+
* Fix serialization bug when using ``MM_COERCE_KEYS_TO_STRINGS`` together with
|
|
29
|
+
``sort_keys=True`` (`issue #229`__)
|
|
30
|
+
|
|
31
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/229
|
|
32
|
+
|
|
33
|
+
|
|
4
34
|
1.22 (2025-10-21)
|
|
5
35
|
~~~~~~~~~~~~~~~~~
|
|
6
36
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-rapidjson
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.24
|
|
4
4
|
Summary: Python wrapper around rapidjson
|
|
5
5
|
Home-page: https://github.com/python-rapidjson/python-rapidjson
|
|
6
6
|
Author: Ken Robbins
|
|
@@ -14,14 +14,12 @@ Classifier: Intended Audience :: Developers
|
|
|
14
14
|
Classifier: Programming Language :: C++
|
|
15
15
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.14
|
|
23
22
|
Classifier: Programming Language :: Python
|
|
24
|
-
Requires-Python: >=3.6
|
|
25
23
|
Description-Content-Type: text/x-rst
|
|
26
24
|
License-File: LICENSE
|
|
27
25
|
Dynamic: author
|
|
@@ -35,7 +33,6 @@ Dynamic: license
|
|
|
35
33
|
Dynamic: license-file
|
|
36
34
|
Dynamic: maintainer
|
|
37
35
|
Dynamic: maintainer-email
|
|
38
|
-
Dynamic: requires-python
|
|
39
36
|
Dynamic: summary
|
|
40
37
|
|
|
41
38
|
.. -*- coding: utf-8 -*-
|
|
@@ -188,6 +185,36 @@ __ https://python-rapidjson.readthedocs.io/en/latest/quickstart.html#incompatibi
|
|
|
188
185
|
Changes
|
|
189
186
|
-------
|
|
190
187
|
|
|
188
|
+
1.24 (2026-09-05)
|
|
189
|
+
~~~~~~~~~~~~~~~~~
|
|
190
|
+
|
|
191
|
+
* Fix error handling after ``PyList_SetItem()`` calls (`issue 231`__)
|
|
192
|
+
|
|
193
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/231
|
|
194
|
+
|
|
195
|
+
* Fix error handling after ``PyList_Append()`` calls (`issue 232`__)
|
|
196
|
+
|
|
197
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/232
|
|
198
|
+
|
|
199
|
+
* Fix crash serializing a list that changes on the fly (`issue 238`__)
|
|
200
|
+
|
|
201
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/238
|
|
202
|
+
|
|
203
|
+
* Fix memory leak in ``RawJSON`` constructor with invalid argument (`PR #239`__), thanks
|
|
204
|
+
to Junhyung Lee
|
|
205
|
+
|
|
206
|
+
__ https://github.com/python-rapidjson/python-rapidjson/pull/239
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
1.23 (2025-12-07)
|
|
210
|
+
~~~~~~~~~~~~~~~~~
|
|
211
|
+
|
|
212
|
+
* Fix serialization bug when using ``MM_COERCE_KEYS_TO_STRINGS`` together with
|
|
213
|
+
``sort_keys=True`` (`issue #229`__)
|
|
214
|
+
|
|
215
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/229
|
|
216
|
+
|
|
217
|
+
|
|
191
218
|
1.22 (2025-10-21)
|
|
192
219
|
~~~~~~~~~~~~~~~~~
|
|
193
220
|
|
|
@@ -5,41 +5,41 @@ Serialization
|
|
|
5
5
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
6
6
|
| serialize | ``dumps()``\ [1]_ | ``Encoder()``\ [2]_ | ``dumps(n)``\ [3]_ | ``Encoder(n)``\ [4]_ | ``PyEncoder()``\ [5]_ | simdjson\ [6]_ | orjson\ [7]_ | ujson\ [8]_ | simplejson\ [9]_ | stdlib\ [10]_ |
|
|
7
7
|
+=======================+=======================+=======================+=======================+=======================+=======================+=======================+=======================+=======================+=======================+=======================+
|
|
8
|
-
| 100 arrays dict | 1.00 |
|
|
8
|
+
| 100 arrays dict | 1.00 | 0.99 | 0.66 | 0.67 | 0.99 | 1.23 | **0.12** | 0.92 | 3.54 | 1.23 |
|
|
9
9
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
10
|
-
| 100 dicts array | 1.00 | 1.
|
|
10
|
+
| 100 dicts array | 1.00 | 1.03 | 0.72 | 0.68 | 1.02 | 1.35 | **0.15** | 0.91 | 4.39 | 1.35 |
|
|
11
11
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
12
|
-
| 256 Trues array | 1.00 |
|
|
12
|
+
| 256 Trues array | 1.00 | 1.01 | 1.17 | 1.00 | 1.02 | 1.97 | **0.20** | 1.83 | 2.90 | 1.98 |
|
|
13
13
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
14
|
-
| 256 ascii array | 1.00 | 1.00 | 1.01 | 1.00 | 1.00 | 1.
|
|
14
|
+
| 256 ascii array | 1.00 | 1.00 | 1.01 | 1.00 | 1.00 | 1.08 | **0.09** | 0.64 | 0.91 | 1.08 |
|
|
15
15
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
16
|
-
| 256 doubles array | 1.00 | 1.00 | 1.00 | 1.
|
|
16
|
+
| 256 doubles array | 1.00 | 1.00 | 1.00 | 1.01 | 1.01 | 0.87 | **0.04** | 0.24 | 0.91 | 0.87 |
|
|
17
17
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
18
|
-
| 256 unicode array | 1.00 | 0.99 |
|
|
18
|
+
| 256 unicode array | 1.00 | 0.99 | 0.99 | 0.99 | 0.99 | 0.72 | **0.02** | 0.39 | 2.11 | 0.72 |
|
|
19
19
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
20
|
-
| apache.json | 1.00 |
|
|
20
|
+
| apache.json | 1.00 | 1.00 | 1.00 | 0.99 | 1.00 | 1.51 | **0.18** | 1.03 | 2.43 | 1.51 |
|
|
21
21
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
22
|
-
| canada.json | 1.00 | 1.00 | 0.99 | 0.99 | 1.01 |
|
|
22
|
+
| canada.json | 1.00 | 1.00 | 0.99 | 0.99 | 1.01 | 0.94 | **0.06** | 0.33 | 1.50 | 0.94 |
|
|
23
23
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
24
|
-
| complex object | 1.00 | 1.
|
|
24
|
+
| complex object | 1.00 | 1.01 | 0.92 | 0.91 | 1.01 | 1.21 | **0.13** | 0.69 | 2.28 | 1.21 |
|
|
25
25
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
26
|
-
| composite object | 1.00 |
|
|
26
|
+
| composite object | 1.00 | 1.01 | 0.66 | 0.63 | 1.01 | 1.35 | **0.16** | 0.94 | 2.60 | 1.36 |
|
|
27
27
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
28
|
-
| ctm.json | 1.00 |
|
|
28
|
+
| ctm.json | 1.00 | 1.00 | 0.70 | 0.70 | 1.00 | 1.35 | **0.19** | 1.11 | 3.87 | 1.32 |
|
|
29
29
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
30
|
-
| github.json | 1.00 | 1.00 | 0.
|
|
30
|
+
| github.json | 1.00 | 1.00 | 0.96 | 0.95 | 0.99 | 1.21 | **0.14** | 0.86 | 1.54 | 1.21 |
|
|
31
31
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
32
|
-
| instruments.json | 1.00 |
|
|
32
|
+
| instruments.json | 1.00 | 1.00 | 0.70 | 0.70 | 1.00 | 1.21 | **0.17** | 0.94 | 2.06 | 1.21 |
|
|
33
33
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
34
|
-
| mesh.json | 1.00 | 1.00 | 0.
|
|
34
|
+
| mesh.json | 1.00 | 1.00 | 0.87 | 0.87 | 1.00 | 0.78 | **0.08** | 0.33 | 1.02 | 0.79 |
|
|
35
35
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
36
|
-
| truenull.json | 1.00 | 1.00 | 1.
|
|
36
|
+
| truenull.json | 1.00 | 1.00 | 1.04 | 1.00 | 1.00 | 1.36 | **0.22** | 2.06 | 2.29 | 1.37 |
|
|
37
37
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
38
|
-
| tweet.json | 1.00 | 1.00 | 0.
|
|
38
|
+
| tweet.json | 1.00 | 1.00 | 0.99 | 0.94 | 1.01 | 1.45 | **0.20** | 0.93 | 2.26 | 1.44 |
|
|
39
39
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
40
|
-
| twitter.json | 1.00 | 1.00 | 0.95 | 0.
|
|
40
|
+
| twitter.json | 1.00 | 1.00 | 0.95 | 0.95 | 1.00 | 1.13 | **0.16** | 0.95 | 1.82 | 1.14 |
|
|
41
41
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
42
|
-
| overall | 1.00 |
|
|
42
|
+
| overall | 1.00 | 0.99 | 0.75 | 0.75 | 0.99 | 1.14 | **0.11** | 0.76 | 2.95 | 1.14 |
|
|
43
43
|
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
44
44
|
|
|
45
45
|
Deserialization
|
|
@@ -48,41 +48,41 @@ Deserialization
|
|
|
48
48
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
49
49
|
| deserialize | ``loads()``\ [11]_ | ``Decoder()``\ [12]_ | ``loads(n)``\ [13]_ | ``Decoder(n)``\ [14]_ | ``PyDecoder()``\ [15]_ | simdjson | orjson | ujson | simplejson | stdlib |
|
|
50
50
|
+=======================+========================+========================+========================+========================+========================+========================+========================+========================+========================+========================+
|
|
51
|
-
| 100 arrays dict | 1.00 | 1.00 | 0.
|
|
51
|
+
| 100 arrays dict | 1.00 | 1.00 | 0.90 | 0.90 | 1.76 | 0.85 | **0.57** | 0.91 | 1.18 | 1.10 |
|
|
52
52
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
53
|
-
| 100 dicts array | 1.00 | 1.00 | 0.
|
|
53
|
+
| 100 dicts array | 1.00 | 1.00 | 0.85 | 0.83 | 1.58 | 0.63 | **0.40** | 0.74 | 1.28 | 1.12 |
|
|
54
54
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
55
|
-
| 256 Trues array | 1.00 | 1.
|
|
55
|
+
| 256 Trues array | 1.00 | 1.00 | 1.08 | 1.00 | 1.12 | 1.03 | **0.37** | 0.96 | 1.74 | 1.34 |
|
|
56
56
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
57
|
-
| 256 ascii array | 1.00 | 1.
|
|
57
|
+
| 256 ascii array | 1.00 | 1.01 | 1.03 | 1.01 | 1.71 | 0.60 | **0.60** | 1.27 | 1.18 | 1.25 |
|
|
58
58
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
59
|
-
| 256 doubles array | 1.00 | 1.
|
|
59
|
+
| 256 doubles array | 1.00 | 1.00 | 0.26 | 0.26 | 1.02 | 0.22 | **0.16** | 0.55 | 1.17 | 1.15 |
|
|
60
60
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
61
|
-
| 256 unicode array | 1.00 | 1.00 | 1.01 | 1.
|
|
61
|
+
| 256 unicode array | 1.00 | 1.00 | 1.01 | 1.01 | 1.03 | 0.96 | **0.35** | 0.67 | 1.17 | 1.43 |
|
|
62
62
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
63
|
-
| apache.json | 1.00 | 1.01 |
|
|
63
|
+
| apache.json | 1.00 | 1.01 | 0.98 | 0.99 | 1.50 | 0.68 | **0.52** | 0.87 | 0.94 | 0.96 |
|
|
64
64
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
65
|
-
| canada.json | 1.00 | 1.00 | 0.34 | 0.35 | 1.
|
|
65
|
+
| canada.json | 1.00 | 1.00 | 0.34 | 0.35 | 1.14 | 0.30 | **0.26** | 0.51 | 1.13 | 1.09 |
|
|
66
66
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
67
|
-
| complex object | 1.00 | 1.00 | 0.
|
|
67
|
+
| complex object | 1.00 | 1.00 | 0.85 | 0.85 | 1.29 | 0.69 | **0.40** | 0.75 | 1.11 | 1.03 |
|
|
68
68
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
69
|
-
| composite object | 1.00 | 1.01 | 0.
|
|
69
|
+
| composite object | 1.00 | 1.01 | 0.85 | 0.84 | 1.38 | 0.60 | **0.52** | 0.68 | 1.29 | 1.12 |
|
|
70
70
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
71
|
-
| ctm.json | 1.00 | 1.00 | 0.89 | 0.
|
|
71
|
+
| ctm.json | 1.00 | 1.00 | 0.89 | 0.90 | 1.46 | 0.78 | **0.52** | 1.06 | 1.32 | 1.36 |
|
|
72
72
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
73
|
-
| github.json | 1.00 | 1.
|
|
73
|
+
| github.json | 1.00 | 1.00 | 0.93 | 0.95 | 1.33 | 0.69 | **0.49** | 0.86 | 1.00 | 1.00 |
|
|
74
74
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
75
|
-
| instruments.json | 1.00 | 1.
|
|
75
|
+
| instruments.json | 1.00 | 1.00 | 0.86 | 0.86 | 1.22 | 0.64 | **0.37** | 0.70 | 1.06 | 1.00 |
|
|
76
76
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
77
|
-
| mesh.json | 1.00 | 1.
|
|
77
|
+
| mesh.json | 1.00 | 1.01 | 0.52 | 0.52 | 1.01 | 0.47 | **0.37** | 0.67 | 1.40 | 1.13 |
|
|
78
78
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
79
|
-
| truenull.json | 1.00 | 1.
|
|
79
|
+
| truenull.json | 1.00 | 1.00 | 1.00 | 1.00 | 1.01 | 0.88 | **0.27** | 0.46 | 0.92 | 0.83 |
|
|
80
80
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
81
|
-
| tweet.json | 1.00 | 1.
|
|
81
|
+
| tweet.json | 1.00 | 1.01 | 0.95 | 0.95 | 1.31 | 0.72 | **0.46** | 0.86 | 1.21 | 1.11 |
|
|
82
82
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
83
|
-
| twitter.json | 1.00 | 1.
|
|
83
|
+
| twitter.json | 1.00 | 1.01 | 0.97 | 0.97 | 1.26 | 0.73 | **0.47** | 0.95 | 1.13 | 1.21 |
|
|
84
84
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
85
|
-
| overall | 1.00 | 1.00 | 0.
|
|
85
|
+
| overall | 1.00 | 1.00 | 0.85 | 0.85 | 1.69 | 0.80 | **0.54** | 0.88 | 1.18 | 1.10 |
|
|
86
86
|
+-----------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
|
|
87
87
|
|
|
88
88
|
ASCII vs UTF-8 Serialization
|
|
@@ -91,11 +91,11 @@ ASCII vs UTF-8 Serialization
|
|
|
91
91
|
+-------------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
92
92
|
| serialize | ``rj ascii``\ [16]_ | ``rj utf8``\ [17]_ | ``uj ascii``\ [18]_ | ``uj utf8``\ [19]_ | ``sj ascii``\ [20]_ | ``sj utf8``\ [21]_ | ``json ascii``\ [22]_ | ``json utf8``\ [23]_ |
|
|
93
93
|
+=========================+=======================+=======================+=======================+=======================+=======================+=======================+=======================+=======================+
|
|
94
|
-
| Long ASCII string | 1.00 | 0.
|
|
94
|
+
| Long ASCII string | 1.00 | 0.53 | 0.44 | 0.47 | **0.35** | 0.39 | 0.73 | 1.41 |
|
|
95
95
|
+-------------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
96
|
-
| Long Unicode string | 1.00 | 0.
|
|
96
|
+
| Long Unicode string | 1.00 | 0.60 | 0.37 | 0.55 | 1.84 | **0.20** | 0.66 | 0.55 |
|
|
97
97
|
+-------------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
98
|
-
| overall | 1.00 | 0.
|
|
98
|
+
| overall | 1.00 | 0.58 | 0.39 | 0.53 | 1.45 | **0.25** | 0.68 | 0.77 |
|
|
99
99
|
+-------------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
|
|
100
100
|
|
|
101
101
|
.. [1] ``rapidjson.dumps()``
|
|
@@ -104,10 +104,10 @@ ASCII vs UTF-8 Serialization
|
|
|
104
104
|
.. [4] ``rapidjson.Encoder(number_mode=NM_NATIVE)``
|
|
105
105
|
.. [5] ``rapidjson.Encoder()`` subclassed in Python with *no-op* hook methods
|
|
106
106
|
.. [6] `simdjson 3.12.3 <https://pypi.org/project/pysimdjson/>`__
|
|
107
|
-
.. [7] `orjson 3.
|
|
108
|
-
.. [8] `ujson 5.
|
|
109
|
-
.. [9] `simplejson
|
|
110
|
-
.. [10] Python 3.
|
|
107
|
+
.. [7] `orjson 3.12.0 <https://pypi.org/project/orjson/3.12.0/>`__
|
|
108
|
+
.. [8] `ujson 5.13.0 <https://pypi.org/project/ujson/5.13.0/>`__
|
|
109
|
+
.. [9] `simplejson 4.1.1 <https://pypi.org/pypi/simplejson/4.1.1>`__
|
|
110
|
+
.. [10] Python 3.14.7 standard library ``json``
|
|
111
111
|
.. [11] ``rapidjson.loads()``
|
|
112
112
|
.. [12] ``rapidjson.Decoder()``
|
|
113
113
|
.. [13] ``rapidjson.loads(number_mode=NM_NATIVE)``
|
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
Changes
|
|
2
2
|
-------
|
|
3
3
|
|
|
4
|
+
1.24 (2026-09-05)
|
|
5
|
+
~~~~~~~~~~~~~~~~~
|
|
6
|
+
|
|
7
|
+
* Fix error handling after ``PyList_SetItem()`` calls (`issue 231`__)
|
|
8
|
+
|
|
9
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/231
|
|
10
|
+
|
|
11
|
+
* Fix error handling after ``PyList_Append()`` calls (`issue 232`__)
|
|
12
|
+
|
|
13
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/232
|
|
14
|
+
|
|
15
|
+
* Fix crash serializing a list that changes on the fly (`issue 238`__)
|
|
16
|
+
|
|
17
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/238
|
|
18
|
+
|
|
19
|
+
* Fix memory leak in ``RawJSON`` constructor with invalid argument (`PR #239`__), thanks
|
|
20
|
+
to Junhyung Lee
|
|
21
|
+
|
|
22
|
+
__ https://github.com/python-rapidjson/python-rapidjson/pull/239
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
1.23 (2025-12-07)
|
|
26
|
+
~~~~~~~~~~~~~~~~~
|
|
27
|
+
|
|
28
|
+
* Fix serialization bug when using ``MM_COERCE_KEYS_TO_STRINGS`` together with
|
|
29
|
+
``sort_keys=True`` (`issue #229`__)
|
|
30
|
+
|
|
31
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/229
|
|
32
|
+
|
|
33
|
+
|
|
4
34
|
1.22 (2025-10-21)
|
|
5
35
|
~~~~~~~~~~~~~~~~~
|
|
6
36
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-rapidjson
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.24
|
|
4
4
|
Summary: Python wrapper around rapidjson
|
|
5
5
|
Home-page: https://github.com/python-rapidjson/python-rapidjson
|
|
6
6
|
Author: Ken Robbins
|
|
@@ -14,14 +14,12 @@ Classifier: Intended Audience :: Developers
|
|
|
14
14
|
Classifier: Programming Language :: C++
|
|
15
15
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.14
|
|
23
22
|
Classifier: Programming Language :: Python
|
|
24
|
-
Requires-Python: >=3.6
|
|
25
23
|
Description-Content-Type: text/x-rst
|
|
26
24
|
License-File: LICENSE
|
|
27
25
|
Dynamic: author
|
|
@@ -35,7 +33,6 @@ Dynamic: license
|
|
|
35
33
|
Dynamic: license-file
|
|
36
34
|
Dynamic: maintainer
|
|
37
35
|
Dynamic: maintainer-email
|
|
38
|
-
Dynamic: requires-python
|
|
39
36
|
Dynamic: summary
|
|
40
37
|
|
|
41
38
|
.. -*- coding: utf-8 -*-
|
|
@@ -188,6 +185,36 @@ __ https://python-rapidjson.readthedocs.io/en/latest/quickstart.html#incompatibi
|
|
|
188
185
|
Changes
|
|
189
186
|
-------
|
|
190
187
|
|
|
188
|
+
1.24 (2026-09-05)
|
|
189
|
+
~~~~~~~~~~~~~~~~~
|
|
190
|
+
|
|
191
|
+
* Fix error handling after ``PyList_SetItem()`` calls (`issue 231`__)
|
|
192
|
+
|
|
193
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/231
|
|
194
|
+
|
|
195
|
+
* Fix error handling after ``PyList_Append()`` calls (`issue 232`__)
|
|
196
|
+
|
|
197
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/232
|
|
198
|
+
|
|
199
|
+
* Fix crash serializing a list that changes on the fly (`issue 238`__)
|
|
200
|
+
|
|
201
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/238
|
|
202
|
+
|
|
203
|
+
* Fix memory leak in ``RawJSON`` constructor with invalid argument (`PR #239`__), thanks
|
|
204
|
+
to Junhyung Lee
|
|
205
|
+
|
|
206
|
+
__ https://github.com/python-rapidjson/python-rapidjson/pull/239
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
1.23 (2025-12-07)
|
|
210
|
+
~~~~~~~~~~~~~~~~~
|
|
211
|
+
|
|
212
|
+
* Fix serialization bug when using ``MM_COERCE_KEYS_TO_STRINGS`` together with
|
|
213
|
+
``sort_keys=True`` (`issue #229`__)
|
|
214
|
+
|
|
215
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/229
|
|
216
|
+
|
|
217
|
+
|
|
191
218
|
1.22 (2025-10-21)
|
|
192
219
|
~~~~~~~~~~~~~~~~~
|
|
193
220
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// :Author: Ken Robbins <ken@kenrobbins.com>
|
|
4
4
|
// :License: MIT License
|
|
5
5
|
// :Copyright: © 2015 Ken Robbins
|
|
6
|
-
// :Copyright: © 2015
|
|
6
|
+
// :Copyright: © 2015-2026 Lele Gaifax
|
|
7
7
|
//
|
|
8
8
|
|
|
9
9
|
#include <locale.h>
|
|
@@ -465,7 +465,6 @@ RawJSON_dealloc(RawJSON* self)
|
|
|
465
465
|
static PyObject*
|
|
466
466
|
RawJSON_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
|
|
467
467
|
{
|
|
468
|
-
PyObject* self = type->tp_alloc(type, 0);
|
|
469
468
|
static char const* kwlist[] = {
|
|
470
469
|
"value",
|
|
471
470
|
NULL
|
|
@@ -475,6 +474,10 @@ RawJSON_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
|
|
|
475
474
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "U", (char**) kwlist, &value))
|
|
476
475
|
return NULL;
|
|
477
476
|
|
|
477
|
+
PyObject* self = type->tp_alloc(type, 0);
|
|
478
|
+
if (self == NULL)
|
|
479
|
+
return NULL;
|
|
480
|
+
|
|
478
481
|
((RawJSON*) self)->value = value;
|
|
479
482
|
|
|
480
483
|
Py_INCREF(value);
|
|
@@ -909,8 +912,11 @@ struct PyHandler {
|
|
|
909
912
|
return false;
|
|
910
913
|
}
|
|
911
914
|
} else {
|
|
912
|
-
PyList_Append(current.object, value);
|
|
915
|
+
int rc = PyList_Append(current.object, value);
|
|
913
916
|
Py_DECREF(value);
|
|
917
|
+
if (rc == -1) {
|
|
918
|
+
return false;
|
|
919
|
+
}
|
|
914
920
|
}
|
|
915
921
|
} else {
|
|
916
922
|
root = value;
|
|
@@ -1054,11 +1060,11 @@ struct PyHandler {
|
|
|
1054
1060
|
|
|
1055
1061
|
rc = PyList_SetItem(current.object, listLen - 1, pair);
|
|
1056
1062
|
|
|
1057
|
-
// NB: PyList_SetItem() steals a reference on the replacement,
|
|
1058
|
-
//
|
|
1063
|
+
// NB: PyList_SetItem() always steals a reference on the replacement,
|
|
1064
|
+
// even in case of error:
|
|
1065
|
+
// https://docs.python.org/3/c-api/list.html#c.PyList_SetItem
|
|
1059
1066
|
|
|
1060
1067
|
if (rc == -1) {
|
|
1061
|
-
Py_DECREF(pair);
|
|
1062
1068
|
return false;
|
|
1063
1069
|
}
|
|
1064
1070
|
} else {
|
|
@@ -1079,11 +1085,11 @@ struct PyHandler {
|
|
|
1079
1085
|
Py_ssize_t listLen = PyList_GET_SIZE(current.object);
|
|
1080
1086
|
int rc = PyList_SetItem(current.object, listLen - 1, replacement);
|
|
1081
1087
|
|
|
1082
|
-
// NB: PyList_SetItem() steals a reference on the replacement,
|
|
1083
|
-
//
|
|
1088
|
+
// NB: PyList_SetItem() always steals a reference on the replacement,
|
|
1089
|
+
// even in case of error:
|
|
1090
|
+
// https://docs.python.org/3/c-api/list.html#c.PyList_SetItem
|
|
1084
1091
|
|
|
1085
1092
|
if (rc == -1) {
|
|
1086
|
-
Py_DECREF(replacement);
|
|
1087
1093
|
return false;
|
|
1088
1094
|
}
|
|
1089
1095
|
}
|
|
@@ -1174,11 +1180,11 @@ struct PyHandler {
|
|
|
1174
1180
|
Py_ssize_t listLen = PyList_GET_SIZE(current.object);
|
|
1175
1181
|
int rc = PyList_SetItem(current.object, listLen - 1, replacement);
|
|
1176
1182
|
|
|
1177
|
-
// NB: PyList_SetItem() steals a reference on the replacement,
|
|
1178
|
-
//
|
|
1179
|
-
|
|
1183
|
+
// NB: PyList_SetItem() always steals a reference on the replacement,
|
|
1184
|
+
// even in case of error:
|
|
1185
|
+
// https://docs.python.org/3/c-api/list.html#c.PyList_SetItem
|
|
1186
|
+
//
|
|
1180
1187
|
if (rc == -1) {
|
|
1181
|
-
Py_DECREF(replacement);
|
|
1182
1188
|
return false;
|
|
1183
1189
|
}
|
|
1184
1190
|
}
|
|
@@ -2297,23 +2303,17 @@ decoder_new(PyTypeObject* type, PyObject* args, PyObject* kwargs)
|
|
|
2297
2303
|
|
|
2298
2304
|
|
|
2299
2305
|
struct DictItem {
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
: key_str(k),
|
|
2308
|
-
key_size(s),
|
|
2309
|
-
item(i)
|
|
2306
|
+
std::string key;
|
|
2307
|
+
PyObject* value;
|
|
2308
|
+
|
|
2309
|
+
DictItem(std::string k,
|
|
2310
|
+
PyObject* v)
|
|
2311
|
+
: key(k),
|
|
2312
|
+
value(v)
|
|
2310
2313
|
{}
|
|
2311
2314
|
|
|
2312
2315
|
bool operator<(const DictItem& other) const {
|
|
2313
|
-
|
|
2314
|
-
Py_ssize_t oks = other.key_size;
|
|
2315
|
-
int cmp = strncmp(this->key_str, other.key_str, tks < oks ? tks : oks);
|
|
2316
|
-
return (cmp == 0) ? (tks < oks) : (cmp < 0);
|
|
2316
|
+
return key < other.key;
|
|
2317
2317
|
}
|
|
2318
2318
|
};
|
|
2319
2319
|
|
|
@@ -2510,9 +2510,7 @@ dumps_internal(
|
|
|
2510
2510
|
(!(iterableMode & IM_ONLY_LISTS) && PyList_Check(object))) {
|
|
2511
2511
|
writer->StartArray();
|
|
2512
2512
|
|
|
2513
|
-
Py_ssize_t
|
|
2514
|
-
|
|
2515
|
-
for (Py_ssize_t i = 0; i < size; i++) {
|
|
2513
|
+
for (Py_ssize_t i = 0; i < PyList_GET_SIZE(object); i++) {
|
|
2516
2514
|
if (Py_EnterRecursiveCall(" while JSONifying list object"))
|
|
2517
2515
|
return false;
|
|
2518
2516
|
PyObject* item = PyList_GET_ITEM(object, i);
|
|
@@ -2613,7 +2611,7 @@ dumps_internal(
|
|
|
2613
2611
|
return false;
|
|
2614
2612
|
}
|
|
2615
2613
|
ASSERT_VALID_SIZE(l);
|
|
2616
|
-
items.push_back(DictItem(key_str, l, item));
|
|
2614
|
+
items.push_back(DictItem(std::string(key_str, l), item));
|
|
2617
2615
|
} else if (!(mappingMode & MM_SKIP_NON_STRING_KEYS)) {
|
|
2618
2616
|
PyErr_SetString(PyExc_TypeError, "keys must be strings");
|
|
2619
2617
|
assert(!coercedKey);
|
|
@@ -2625,10 +2623,10 @@ dumps_internal(
|
|
|
2625
2623
|
std::sort(items.begin(), items.end());
|
|
2626
2624
|
|
|
2627
2625
|
for (size_t i=0, s=items.size(); i < s; i++) {
|
|
2628
|
-
writer->Key(items[i].
|
|
2626
|
+
writer->Key(items[i].key.c_str(), (SizeType) items[i].key.length());
|
|
2629
2627
|
if (Py_EnterRecursiveCall(" while JSONifying dict object"))
|
|
2630
2628
|
return false;
|
|
2631
|
-
bool r = RECURSE(items[i].
|
|
2629
|
+
bool r = RECURSE(items[i].value);
|
|
2632
2630
|
Py_LeaveRecursiveCall();
|
|
2633
2631
|
if (!r)
|
|
2634
2632
|
return false;
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
# :License: MIT License
|
|
5
5
|
# :Copyright: © 2015 John Anderson
|
|
6
6
|
# :Copyright: © 2015 Ken Robbins
|
|
7
|
-
# :Copyright: © 2015, 2017, 2018, 2021, 2022, 2023, 2024, 2025 Lele Gaifax
|
|
7
|
+
# :Copyright: © 2015, 2017, 2018, 2021, 2022, 2023, 2024, 2025, 2026 Lele Gaifax
|
|
8
8
|
#
|
|
9
9
|
|
|
10
|
-
mypy==
|
|
11
|
-
pytest==
|
|
12
|
-
pytz==
|
|
10
|
+
mypy==2.3.1
|
|
11
|
+
pytest==9.1.1
|
|
12
|
+
pytz==2022.2
|
|
13
13
|
sphinx==8.2.3
|
|
14
|
+
typing-extensions==4.16.0
|
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
# :Project: python-rapidjson -- Development requirements
|
|
3
3
|
# :Author: Lele Gaifax <lele@metapensiero.it>
|
|
4
4
|
# :License: MIT License
|
|
5
|
-
# :Copyright: © 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025 Lele Gaifax
|
|
5
|
+
# :Copyright: © 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026 Lele Gaifax
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
-r requirements-test.txt
|
|
9
9
|
|
|
10
|
+
# Needed on Python >= 3.12
|
|
11
|
+
setuptools
|
|
12
|
+
|
|
10
13
|
# Needed by make release
|
|
11
|
-
bump-my-version==1.
|
|
12
|
-
readme-renderer==
|
|
13
|
-
twine==
|
|
14
|
+
bump-my-version==1.5.1
|
|
15
|
+
readme-renderer==45.0
|
|
16
|
+
twine==7.0.0
|
|
14
17
|
|
|
15
18
|
# Needed by make benchmarks-*
|
|
16
|
-
pytest-benchmark==5.
|
|
19
|
+
pytest-benchmark==5.2.3
|
|
17
20
|
|
|
18
21
|
pysimdjson==7.0.2
|
|
19
|
-
orjson==3.
|
|
20
|
-
simplejson==
|
|
21
|
-
ujson==5.
|
|
22
|
+
orjson==3.12.0
|
|
23
|
+
simplejson==4.1.1
|
|
24
|
+
ujson==5.13.0
|
|
@@ -3,29 +3,18 @@
|
|
|
3
3
|
# :Author: Ken Robbins <ken@kenrobbins.com>
|
|
4
4
|
# :License: MIT License
|
|
5
5
|
# :Copyright: © 2015 Ken Robbins
|
|
6
|
-
# :Copyright: © 2016
|
|
6
|
+
# :Copyright: © 2016-2026 Lele Gaifax
|
|
7
7
|
#
|
|
8
8
|
|
|
9
9
|
import os.path
|
|
10
10
|
import sys
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
from setuptools import setup, Extension
|
|
14
|
-
try:
|
|
15
|
-
# This is needed for some old versions of setuptools
|
|
16
|
-
import packaging.specifiers
|
|
17
|
-
except ImportError:
|
|
18
|
-
pass
|
|
19
|
-
other_setup_options = {'python_requires': '>=3.6'}
|
|
20
|
-
except ImportError:
|
|
21
|
-
from distutils.core import setup, Extension
|
|
22
|
-
other_setup_options = {}
|
|
23
|
-
|
|
12
|
+
from setuptools import setup, Extension
|
|
24
13
|
from distutils import sysconfig
|
|
25
14
|
|
|
26
15
|
|
|
27
|
-
if sys.version_info < (3,
|
|
28
|
-
raise NotImplementedError("Only Python 3.
|
|
16
|
+
if sys.version_info < (3, 10):
|
|
17
|
+
raise NotImplementedError("Only Python 3.10+ is supported.")
|
|
29
18
|
|
|
30
19
|
ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
|
|
31
20
|
|
|
@@ -44,7 +33,7 @@ else:
|
|
|
44
33
|
" want to report the issue.")
|
|
45
34
|
|
|
46
35
|
# Automatically updated by bump-my-version at release time
|
|
47
|
-
VERSION = '1.
|
|
36
|
+
VERSION = '1.24'
|
|
48
37
|
|
|
49
38
|
with open('README.rst', encoding='utf-8') as f:
|
|
50
39
|
LONG_DESCRIPTION = f.read()
|
|
@@ -81,11 +70,6 @@ if cxx and 'g++' in cxx:
|
|
|
81
70
|
extension_options['extra_compile_args'] = [
|
|
82
71
|
'-pedantic', '-Wno-long-long', '-std=c++11']
|
|
83
72
|
|
|
84
|
-
# Up to Python 3.7, some structures use "char*" instead of "const char*",
|
|
85
|
-
# and ISO C++ forbids assigning string literal constants
|
|
86
|
-
if sys.version_info < (3,7):
|
|
87
|
-
extension_options['extra_compile_args'].append('-Wno-write-strings')
|
|
88
|
-
|
|
89
73
|
|
|
90
74
|
setup(
|
|
91
75
|
name='python-rapidjson',
|
|
@@ -106,7 +90,6 @@ setup(
|
|
|
106
90
|
'Programming Language :: C++',
|
|
107
91
|
'Programming Language :: Python :: 3 :: Only',
|
|
108
92
|
'Programming Language :: Python :: 3',
|
|
109
|
-
'Programming Language :: Python :: 3.9',
|
|
110
93
|
'Programming Language :: Python :: 3.10',
|
|
111
94
|
'Programming Language :: Python :: 3.11',
|
|
112
95
|
'Programming Language :: Python :: 3.12',
|
|
@@ -119,5 +102,4 @@ setup(
|
|
|
119
102
|
packages=["rapidjson-stubs"],
|
|
120
103
|
package_data={"rapidjson-stubs": ["*.pyi"]},
|
|
121
104
|
include_package_data=True,
|
|
122
|
-
**other_setup_options
|
|
123
105
|
)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# :Author: John Anderson <sontek@gmail.com>
|
|
4
4
|
# :License: MIT License
|
|
5
5
|
# :Copyright: © 2015 John Anderson
|
|
6
|
-
# :Copyright: © 2016, 2017, 2018, 2019, 2020, 2021, 2024 Lele Gaifax
|
|
6
|
+
# :Copyright: © 2016, 2017, 2018, 2019, 2020, 2021, 2024, 2026 Lele Gaifax
|
|
7
7
|
#
|
|
8
8
|
|
|
9
9
|
import random
|
|
@@ -105,6 +105,27 @@ def test_dumps_default():
|
|
|
105
105
|
assert result == '[2.0,1.0]'
|
|
106
106
|
|
|
107
107
|
|
|
108
|
+
def test_dumps_default_issue238():
|
|
109
|
+
lst = [object() for _ in range(256)]
|
|
110
|
+
|
|
111
|
+
def default(o):
|
|
112
|
+
del lst[128:]
|
|
113
|
+
return None
|
|
114
|
+
|
|
115
|
+
result = rj.dumps(lst, default=default)
|
|
116
|
+
assert len(rj.loads(result)) == 128
|
|
117
|
+
|
|
118
|
+
lst = [object() for _ in range(128)]
|
|
119
|
+
|
|
120
|
+
def default(o):
|
|
121
|
+
if len(lst) < 256:
|
|
122
|
+
lst.append(object())
|
|
123
|
+
return None
|
|
124
|
+
|
|
125
|
+
result = rj.dumps(lst, default=default)
|
|
126
|
+
assert len(rj.loads(result)) == 256
|
|
127
|
+
|
|
128
|
+
|
|
108
129
|
def test_encoder_default():
|
|
109
130
|
class ComplexEncoder(rj.Encoder):
|
|
110
131
|
def default(self, obj):
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# :Created: dom 17 mar 2019 12:38:24 CET
|
|
4
4
|
# :Author: Lele Gaifax <lele@metapensiero.it>
|
|
5
5
|
# :License: MIT License
|
|
6
|
-
# :Copyright: © 2019, 2021 Lele Gaifax
|
|
6
|
+
# :Copyright: © 2019, 2021, 2026 Lele Gaifax
|
|
7
7
|
#
|
|
8
8
|
|
|
9
9
|
from collections import OrderedDict
|
|
@@ -39,7 +39,7 @@ class JoinDuplicatedKeysDecoder(ObjectsAsKeyValuePairsDecoder):
|
|
|
39
39
|
d = {}
|
|
40
40
|
for k, v in ordered_pairs:
|
|
41
41
|
if k in d:
|
|
42
|
-
if type(d[k])
|
|
42
|
+
if type(d[k]) is list:
|
|
43
43
|
d[k].append(v)
|
|
44
44
|
else:
|
|
45
45
|
newlist = []
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# :Created: dom 10 feb 2019 13:47:32 CET
|
|
4
4
|
# :Author: Lele Gaifax <lele@metapensiero.it>
|
|
5
5
|
# :License: MIT License
|
|
6
|
-
# :Copyright: © 2019, 2025 Lele Gaifax
|
|
6
|
+
# :Copyright: © 2019, 2025, 2026 Lele Gaifax
|
|
7
7
|
#
|
|
8
8
|
|
|
9
9
|
import io
|
|
@@ -13,6 +13,7 @@ import gc
|
|
|
13
13
|
import pytest
|
|
14
14
|
import rapidjson as rj
|
|
15
15
|
|
|
16
|
+
|
|
16
17
|
tracemalloc = pytest.importorskip("tracemalloc")
|
|
17
18
|
|
|
18
19
|
|
|
@@ -125,3 +126,30 @@ def test_failed_validation():
|
|
|
125
126
|
for stat in top_stats[:10]:
|
|
126
127
|
# Uhm, with Py 3.14, on macOS, the diff is 3...
|
|
127
128
|
assert stat.count_diff <= 3
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def test_rejected_rawjson_value():
|
|
132
|
+
tracemalloc.start()
|
|
133
|
+
|
|
134
|
+
snapshot1 = tracemalloc.take_snapshot().filter_traces((
|
|
135
|
+
tracemalloc.Filter(True, __file__),))
|
|
136
|
+
|
|
137
|
+
# start the test
|
|
138
|
+
for j in range(1000):
|
|
139
|
+
try:
|
|
140
|
+
rj.RawJSON(j)
|
|
141
|
+
except TypeError:
|
|
142
|
+
pass
|
|
143
|
+
|
|
144
|
+
del j
|
|
145
|
+
|
|
146
|
+
gc.collect()
|
|
147
|
+
|
|
148
|
+
snapshot2 = tracemalloc.take_snapshot().filter_traces((
|
|
149
|
+
tracemalloc.Filter(True, __file__),))
|
|
150
|
+
|
|
151
|
+
top_stats = snapshot2.compare_to(snapshot1, 'lineno')
|
|
152
|
+
tracemalloc.stop()
|
|
153
|
+
|
|
154
|
+
for stat in top_stats[:10]:
|
|
155
|
+
assert stat.count_diff <= 3
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# :Author: Ken Robbins <ken@kenrobbins.com>
|
|
4
4
|
# :License: MIT License
|
|
5
5
|
# :Copyright: © 2015 Ken Robbins
|
|
6
|
-
# :Copyright: © 2015, 2016, 2017, 2018, 2019, 2020 Lele Gaifax
|
|
6
|
+
# :Copyright: © 2015, 2016, 2017, 2018, 2019, 2020, 2025 Lele Gaifax
|
|
7
7
|
#
|
|
8
8
|
|
|
9
9
|
from calendar import timegm
|
|
@@ -217,6 +217,17 @@ def test_sort_keys(dumps):
|
|
|
217
217
|
assert dumps(o, sort_keys=True) == '{"a":"a","a\\u0000b":"a\\u0000b","a0":"a0","a1":"a1"}'
|
|
218
218
|
|
|
219
219
|
|
|
220
|
+
def test_sort_and_coerce_keys(dumps):
|
|
221
|
+
# Issue 229
|
|
222
|
+
o = {"a": 1, 3: 4.5, date(2025,10,10): 2, date(2025,11,11): 3}
|
|
223
|
+
expected = '{"2025-10-10":2,"2025-11-11":3,"3":4.5,"a":1}'
|
|
224
|
+
assert dumps(o, sort_keys=True, mapping_mode=rj.MM_COERCE_KEYS_TO_STRINGS) == expected
|
|
225
|
+
|
|
226
|
+
o = {"ab": 3, "a": 1, "a\x00b": 2}
|
|
227
|
+
expected = '{"a":1,"a\\u0000b":2,"ab":3}'
|
|
228
|
+
assert dumps(o, sort_keys=True, mapping_mode=rj.MM_COERCE_KEYS_TO_STRINGS) == expected
|
|
229
|
+
|
|
230
|
+
|
|
220
231
|
def test_default():
|
|
221
232
|
class Bar:
|
|
222
233
|
pass
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#
|
|
8
8
|
|
|
9
9
|
import typing as t
|
|
10
|
+
from typing_extensions import disjoint_base # type: ignore[attr-defined]
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
__rapidjson_exact_version__: str
|
|
@@ -164,19 +165,20 @@ class JSONDecodeError(Exception): ...
|
|
|
164
165
|
class ValidationError(Exception): ...
|
|
165
166
|
|
|
166
167
|
|
|
168
|
+
@disjoint_base
|
|
167
169
|
class Decoder:
|
|
168
170
|
datetime_mode: _DatetimeMode
|
|
169
171
|
number_mode: _NumberMode
|
|
170
172
|
parse_mode: _ParseMode
|
|
171
173
|
uuid_mode: _UUIDMode
|
|
172
174
|
|
|
173
|
-
def
|
|
174
|
-
|
|
175
|
+
def __new__(
|
|
176
|
+
cls,
|
|
175
177
|
datetime_mode: t.Optional[_DatetimeMode] = DM_NONE,
|
|
176
178
|
number_mode: t.Optional[_NumberMode] = NM_NAN,
|
|
177
179
|
parse_mode: t.Optional[_ParseMode] = PM_NONE,
|
|
178
180
|
uuid_mode: t.Optional[_UUIDMode] = UM_NONE,
|
|
179
|
-
) ->
|
|
181
|
+
) -> Decoder: ...
|
|
180
182
|
def __call__(
|
|
181
183
|
self,
|
|
182
184
|
json: t.Union[str, bytes, bytearray, t.IO],
|
|
@@ -184,6 +186,7 @@ class Decoder:
|
|
|
184
186
|
) -> t.Any: ...
|
|
185
187
|
|
|
186
188
|
|
|
189
|
+
@disjoint_base
|
|
187
190
|
class Encoder:
|
|
188
191
|
bytes_mode: _BytesMode
|
|
189
192
|
datetime_mode: _DatetimeMode
|
|
@@ -198,8 +201,8 @@ class Encoder:
|
|
|
198
201
|
uuid_mode: _UUIDMode
|
|
199
202
|
write_mode: _WriteMode
|
|
200
203
|
|
|
201
|
-
def
|
|
202
|
-
|
|
204
|
+
def __new__(
|
|
205
|
+
cls,
|
|
203
206
|
skip_invalid_keys: t.Optional[bool] = False,
|
|
204
207
|
ensure_ascii: t.Optional[bool] = True,
|
|
205
208
|
write_mode: t.Optional[_WriteMode] = WM_COMPACT,
|
|
@@ -211,7 +214,7 @@ class Encoder:
|
|
|
211
214
|
bytes_mode: t.Optional[_BytesMode] = BM_UTF8,
|
|
212
215
|
iterable_mode: t.Optional[_IterableMode] = IM_ANY_ITERABLE,
|
|
213
216
|
mapping_mode: t.Optional[_MappingMode] = MM_ANY_MAPPING,
|
|
214
|
-
) ->
|
|
217
|
+
) -> Encoder: ...
|
|
215
218
|
def __call__(
|
|
216
219
|
self,
|
|
217
220
|
obj: t.Any,
|
|
@@ -222,11 +225,13 @@ class Encoder:
|
|
|
222
225
|
|
|
223
226
|
@t.final
|
|
224
227
|
class RawJSON:
|
|
225
|
-
value:
|
|
226
|
-
def
|
|
228
|
+
value: str
|
|
229
|
+
def __new__(cls, value: str) -> RawJSON: ...
|
|
227
230
|
|
|
228
231
|
|
|
229
232
|
@t.final
|
|
230
233
|
class Validator:
|
|
231
|
-
def
|
|
234
|
+
def __new__(
|
|
235
|
+
cls, json_schema: t.Union[str, bytes, bytearray]
|
|
236
|
+
) -> Validator: ...
|
|
232
237
|
def __call__(self, json: t.Union[str, bytes, bytearray]) -> None: ...
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/python_rapidjson.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/cursorstreamwrapper.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/filereadstream.h
RENAMED
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/filewritestream.h
RENAMED
|
File without changes
|
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/biginteger.h
RENAMED
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/clzll.h
RENAMED
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/diyfp.h
RENAMED
|
File without changes
|
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/ieee754.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/pow10.h
RENAMED
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/regex.h
RENAMED
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/stack.h
RENAMED
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/strfunc.h
RENAMED
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/strtod.h
RENAMED
|
File without changes
|
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/istreamwrapper.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/msinttypes/inttypes.h
RENAMED
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/msinttypes/stdint.h
RENAMED
|
File without changes
|
{python_rapidjson-1.22 → python_rapidjson-1.24}/rapidjson/include/rapidjson/ostreamwrapper.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|