python-rapidjson 1.23__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.
Files changed (93) hide show
  1. {python_rapidjson-1.23 → python_rapidjson-1.24}/CHANGES.rst +21 -0
  2. {python_rapidjson-1.23 → python_rapidjson-1.24}/PKG-INFO +22 -4
  3. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/benchmarks-tables.rst +43 -43
  4. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/changes.rst +21 -0
  5. {python_rapidjson-1.23 → python_rapidjson-1.24}/python_rapidjson.egg-info/PKG-INFO +22 -4
  6. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson.cpp +20 -16
  7. {python_rapidjson-1.23 → python_rapidjson-1.24}/requirements-test.txt +5 -4
  8. {python_rapidjson-1.23 → python_rapidjson-1.24}/requirements.txt +11 -8
  9. {python_rapidjson-1.23 → python_rapidjson-1.24}/setup.py +5 -23
  10. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_base_types.py +22 -1
  11. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_dict_subclass.py +2 -2
  12. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_memory_leaks.py +29 -1
  13. {python_rapidjson-1.23 → python_rapidjson-1.24}/typings/rapidjson/__init__.pyi +14 -9
  14. {python_rapidjson-1.23 → python_rapidjson-1.24}/.dir-locals.el +0 -0
  15. {python_rapidjson-1.23 → python_rapidjson-1.24}/LICENSE +0 -0
  16. {python_rapidjson-1.23 → python_rapidjson-1.24}/MANIFEST.in +0 -0
  17. {python_rapidjson-1.23 → python_rapidjson-1.24}/README.rst +0 -0
  18. {python_rapidjson-1.23 → python_rapidjson-1.24}/benchmarks/conftest.py +0 -0
  19. {python_rapidjson-1.23 → python_rapidjson-1.24}/benchmarks/tablize.py +0 -0
  20. {python_rapidjson-1.23 → python_rapidjson-1.24}/benchmarks/test_benchmark.py +0 -0
  21. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/Makefile +0 -0
  22. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/api.rst +0 -0
  23. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/benchmarks.rst +0 -0
  24. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/conf.py +0 -0
  25. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/decoder.rst +0 -0
  26. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/dump.rst +0 -0
  27. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/dumps.rst +0 -0
  28. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/encoder.rst +0 -0
  29. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/index.rst +0 -0
  30. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/load.rst +0 -0
  31. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/loads.rst +0 -0
  32. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/quickstart.rst +0 -0
  33. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/rawjson.rst +0 -0
  34. {python_rapidjson-1.23 → python_rapidjson-1.24}/docs/validator.rst +0 -0
  35. {python_rapidjson-1.23 → python_rapidjson-1.24}/python_rapidjson.egg-info/SOURCES.txt +0 -0
  36. {python_rapidjson-1.23 → python_rapidjson-1.24}/python_rapidjson.egg-info/dependency_links.txt +0 -0
  37. {python_rapidjson-1.23 → python_rapidjson-1.24}/python_rapidjson.egg-info/top_level.txt +0 -0
  38. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/allocators.h +0 -0
  39. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/cursorstreamwrapper.h +0 -0
  40. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/document.h +0 -0
  41. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/encodedstream.h +0 -0
  42. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/encodings.h +0 -0
  43. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/error/en.h +0 -0
  44. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/error/error.h +0 -0
  45. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/filereadstream.h +0 -0
  46. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/filewritestream.h +0 -0
  47. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/fwd.h +0 -0
  48. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/biginteger.h +0 -0
  49. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/clzll.h +0 -0
  50. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/diyfp.h +0 -0
  51. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/dtoa.h +0 -0
  52. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/ieee754.h +0 -0
  53. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/itoa.h +0 -0
  54. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/meta.h +0 -0
  55. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/pow10.h +0 -0
  56. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/regex.h +0 -0
  57. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/stack.h +0 -0
  58. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/strfunc.h +0 -0
  59. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/strtod.h +0 -0
  60. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/internal/swap.h +0 -0
  61. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/istreamwrapper.h +0 -0
  62. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/memorybuffer.h +0 -0
  63. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/memorystream.h +0 -0
  64. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/msinttypes/inttypes.h +0 -0
  65. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/msinttypes/stdint.h +0 -0
  66. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/ostreamwrapper.h +0 -0
  67. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/pointer.h +0 -0
  68. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/prettywriter.h +0 -0
  69. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/rapidjson.h +0 -0
  70. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/reader.h +0 -0
  71. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/schema.h +0 -0
  72. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/stream.h +0 -0
  73. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/stringbuffer.h +0 -0
  74. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/uri.h +0 -0
  75. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/include/rapidjson/writer.h +0 -0
  76. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/license.txt +0 -0
  77. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson/readme.md +0 -0
  78. {python_rapidjson-1.23 → python_rapidjson-1.24}/rapidjson_exact_version.txt +0 -0
  79. {python_rapidjson-1.23 → python_rapidjson-1.24}/setup.cfg +0 -0
  80. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/conftest.py +0 -0
  81. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_circular.py +0 -0
  82. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_enum.py +0 -0
  83. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_float.py +0 -0
  84. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_params.py +0 -0
  85. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_pass1.py +0 -0
  86. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_pass2.py +0 -0
  87. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_pass3.py +0 -0
  88. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_rawjson.py +0 -0
  89. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_refs_count.py +0 -0
  90. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_streams.py +0 -0
  91. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_unicode.py +0 -0
  92. {python_rapidjson-1.23 → python_rapidjson-1.24}/tests/test_validator.py +0 -0
  93. {python_rapidjson-1.23 → python_rapidjson-1.24}/tox.ini +0 -0
@@ -1,6 +1,27 @@
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
+
4
25
  1.23 (2025-12-07)
5
26
  ~~~~~~~~~~~~~~~~~
6
27
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-rapidjson
3
- Version: 1.23
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,27 @@ __ 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
+
191
209
  1.23 (2025-12-07)
192
210
  ~~~~~~~~~~~~~~~~~
193
211
 
@@ -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 | 1.00 | 0.73 | 0.72 | 1.00 | 1.34 | **0.14** | 0.94 | 5.48 | 1.34 |
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.00 | 0.79 | 0.76 | 1.00 | 1.55 | **0.20** | 0.96 | 6.73 | 1.53 |
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 | 0.99 | 1.17 | 1.10 | 1.08 | 1.78 | **0.30** | 1.62 | 2.99 | 1.78 |
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.04 | **0.09** | 0.54 | 1.18 | 1.04 |
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.00 | 1.00 | 0.93 | **0.06** | 0.31 | 1.06 | 0.93 |
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 | 1.01 | 1.00 | 0.99 | 0.77 | **0.02** | 0.62 | 0.78 | 0.77 |
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 | 0.99 | 0.99 | 0.99 | 0.99 | 1.34 | **0.18** | 1.24 | 3.15 | 1.34 |
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 | 1.03 | **0.09** | 0.36 | 1.91 | 1.02 |
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.00 | 0.90 | 0.89 | 1.01 | 1.25 | **0.17** | 0.80 | 2.92 | 1.24 |
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 | 0.98 | 0.72 | 0.70 | 0.98 | 1.43 | **0.20** | 0.97 | 2.68 | 1.43 |
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 | 0.97 | 0.72 | 0.72 | 0.97 | 1.37 | **0.21** | 1.26 | 5.89 | 1.35 |
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.97 | 0.96 | 1.00 | 1.13 | **0.14** | 1.00 | 2.13 | 1.13 |
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 | 0.99 | 0.76 | 0.76 | 0.99 | 1.31 | **0.19** | 1.04 | 2.82 | 1.30 |
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.88 | 0.88 | 1.00 | 0.92 | **0.12** | 0.38 | 1.21 | 0.93 |
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.06 | 1.00 | 1.01 | 1.23 | **0.28** | 1.80 | 2.22 | 1.22 |
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.98 | 0.94 | 1.00 | 1.32 | **0.19** | 1.02 | 2.73 | 1.32 |
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.94 | 1.00 | 1.07 | **0.16** | 1.01 | 1.97 | 1.08 |
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 | 1.00 | 0.79 | 0.79 | 1.00 | 1.25 | **0.13** | 0.79 | 4.46 | 1.25 |
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.89 | 0.88 | 1.29 | 0.81 | **0.52** | 0.89 | 1.06 | 0.95 |
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.86 | 0.84 | 1.50 | 0.64 | **0.38** | 0.77 | 1.36 | 1.05 |
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.01 | 1.08 | 1.05 | 1.13 | 0.93 | **0.36** | 0.93 | 1.39 | 1.31 |
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.00 | 1.01 | 0.99 | 1.67 | 0.63 | **0.48** | 1.28 | 1.23 | 1.11 |
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.01 | 0.23 | 0.23 | 1.01 | 0.20 | **0.17** | 0.61 | 1.08 | 1.12 |
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.00 | 1.04 | 1.04 | **0.41** | 0.77 | 4.53 | 1.37 |
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 | 1.00 | 1.00 | 1.45 | 0.72 | **0.49** | 0.95 | 0.98 | 0.90 |
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.07 | 0.31 | **0.28** | 0.59 | 1.06 | 1.04 |
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.81 | 0.83 | 1.25 | 0.60 | **0.38** | 0.84 | 1.10 | 0.97 |
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.84 | 0.83 | 1.34 | 0.62 | **0.44** | 0.66 | 1.34 | 1.05 |
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.89 | 1.36 | 0.81 | **0.54** | 1.21 | 1.15 | 1.32 |
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.02 | 0.98 | 0.97 | 1.31 | 0.73 | **0.45** | 0.91 | 1.01 | 0.90 |
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.01 | 0.83 | 0.83 | 1.19 | 0.62 | **0.35** | 0.73 | 1.02 | 0.90 |
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.00 | 0.50 | 0.50 | 1.01 | 0.44 | **0.36** | 0.70 | 1.26 | 1.13 |
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.01 | 1.01 | 1.00 | 1.02 | 0.95 | **0.29** | 0.88 | 0.96 | 0.92 |
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.00 | 0.97 | 0.96 | 1.27 | 0.72 | **0.44** | 0.98 | 1.25 | 1.04 |
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.00 | 0.96 | 0.96 | 1.20 | 0.75 | **0.44** | 0.98 | 1.04 | 1.09 |
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.84 | 0.83 | 1.27 | 0.76 | **0.49** | 0.87 | 1.07 | 0.96 |
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.52 | **0.29** | 0.36 | 0.73 | 0.81 | 0.73 | 1.43 |
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.57 | 0.62 | **0.47** | 0.69 | 0.53 | 0.73 | 0.57 |
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.56 | 0.53 | **0.44** | 0.70 | 0.61 | 0.73 | 0.80 |
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.10.18 <https://pypi.org/project/orjson/3.10.18/>`__
108
- .. [8] `ujson 5.10.0 <https://pypi.org/project/ujson/5.10.0/>`__
109
- .. [9] `simplejson 3.20.1 <https://pypi.org/pypi/simplejson/3.20.1>`__
110
- .. [10] Python 3.13.5 standard library ``json``
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,27 @@
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
+
4
25
  1.23 (2025-12-07)
5
26
  ~~~~~~~~~~~~~~~~~
6
27
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-rapidjson
3
- Version: 1.23
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,27 @@ __ 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
+
191
209
  1.23 (2025-12-07)
192
210
  ~~~~~~~~~~~~~~~~~
193
211
 
@@ -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, 2021, 2022, 2023, 2024, 2025 Lele Gaifax
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, so it
1058
- // must not be DECREFed when the operation succeeds
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, so it must
1083
- // not be DECREFed when the operation succeeds
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, so it must
1178
- // not be DECREFed when the operation succeeds
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
  }
@@ -2504,9 +2510,7 @@ dumps_internal(
2504
2510
  (!(iterableMode & IM_ONLY_LISTS) && PyList_Check(object))) {
2505
2511
  writer->StartArray();
2506
2512
 
2507
- Py_ssize_t size = PyList_GET_SIZE(object);
2508
-
2509
- for (Py_ssize_t i = 0; i < size; i++) {
2513
+ for (Py_ssize_t i = 0; i < PyList_GET_SIZE(object); i++) {
2510
2514
  if (Py_EnterRecursiveCall(" while JSONifying list object"))
2511
2515
  return false;
2512
2516
  PyObject* item = PyList_GET_ITEM(object, i);
@@ -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==1.16.1
11
- pytest==8.4.1
12
- pytz==2025.2
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.2.0
12
- readme-renderer==44.0
13
- twine==6.1.0
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.1.0
19
+ pytest-benchmark==5.2.3
17
20
 
18
21
  pysimdjson==7.0.2
19
- orjson==3.10.18
20
- simplejson==3.20.1
21
- ujson==5.10.0
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, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025 Lele Gaifax
6
+ # :Copyright: © 2016-2026 Lele Gaifax
7
7
  #
8
8
 
9
9
  import os.path
10
10
  import sys
11
11
 
12
- try:
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, 6):
28
- raise NotImplementedError("Only Python 3.6+ is supported.")
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.23'
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]) == list:
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
@@ -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 __init__(
174
- self,
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
- ) -> None: ...
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 __init__(
202
- self,
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
- ) -> None: ...
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: RawJSON
226
- def __init__(self, value: str) -> None: ...
228
+ value: str
229
+ def __new__(cls, value: str) -> RawJSON: ...
227
230
 
228
231
 
229
232
  @t.final
230
233
  class Validator:
231
- def __init__(self, json_schema: t.Union[str, bytes, bytearray]) -> None: ...
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