python-rapidjson 1.22__tar.gz → 1.23__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.22 → python_rapidjson-1.23}/CHANGES.rst +9 -0
  2. {python_rapidjson-1.22 → python_rapidjson-1.23}/PKG-INFO +10 -1
  3. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/changes.rst +9 -0
  4. {python_rapidjson-1.22 → python_rapidjson-1.23}/python_rapidjson.egg-info/PKG-INFO +10 -1
  5. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson.cpp +12 -18
  6. {python_rapidjson-1.22 → python_rapidjson-1.23}/setup.py +1 -1
  7. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_params.py +12 -1
  8. {python_rapidjson-1.22 → python_rapidjson-1.23}/.dir-locals.el +0 -0
  9. {python_rapidjson-1.22 → python_rapidjson-1.23}/LICENSE +0 -0
  10. {python_rapidjson-1.22 → python_rapidjson-1.23}/MANIFEST.in +0 -0
  11. {python_rapidjson-1.22 → python_rapidjson-1.23}/README.rst +0 -0
  12. {python_rapidjson-1.22 → python_rapidjson-1.23}/benchmarks/conftest.py +0 -0
  13. {python_rapidjson-1.22 → python_rapidjson-1.23}/benchmarks/tablize.py +0 -0
  14. {python_rapidjson-1.22 → python_rapidjson-1.23}/benchmarks/test_benchmark.py +0 -0
  15. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/Makefile +0 -0
  16. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/api.rst +0 -0
  17. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/benchmarks-tables.rst +0 -0
  18. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/benchmarks.rst +0 -0
  19. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/conf.py +0 -0
  20. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/decoder.rst +0 -0
  21. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/dump.rst +0 -0
  22. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/dumps.rst +0 -0
  23. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/encoder.rst +0 -0
  24. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/index.rst +0 -0
  25. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/load.rst +0 -0
  26. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/loads.rst +0 -0
  27. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/quickstart.rst +0 -0
  28. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/rawjson.rst +0 -0
  29. {python_rapidjson-1.22 → python_rapidjson-1.23}/docs/validator.rst +0 -0
  30. {python_rapidjson-1.22 → python_rapidjson-1.23}/python_rapidjson.egg-info/SOURCES.txt +0 -0
  31. {python_rapidjson-1.22 → python_rapidjson-1.23}/python_rapidjson.egg-info/dependency_links.txt +0 -0
  32. {python_rapidjson-1.22 → python_rapidjson-1.23}/python_rapidjson.egg-info/top_level.txt +0 -0
  33. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/allocators.h +0 -0
  34. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/cursorstreamwrapper.h +0 -0
  35. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/document.h +0 -0
  36. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/encodedstream.h +0 -0
  37. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/encodings.h +0 -0
  38. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/error/en.h +0 -0
  39. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/error/error.h +0 -0
  40. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/filereadstream.h +0 -0
  41. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/filewritestream.h +0 -0
  42. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/fwd.h +0 -0
  43. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/biginteger.h +0 -0
  44. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/clzll.h +0 -0
  45. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/diyfp.h +0 -0
  46. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/dtoa.h +0 -0
  47. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/ieee754.h +0 -0
  48. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/itoa.h +0 -0
  49. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/meta.h +0 -0
  50. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/pow10.h +0 -0
  51. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/regex.h +0 -0
  52. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/stack.h +0 -0
  53. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/strfunc.h +0 -0
  54. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/strtod.h +0 -0
  55. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/internal/swap.h +0 -0
  56. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/istreamwrapper.h +0 -0
  57. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/memorybuffer.h +0 -0
  58. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/memorystream.h +0 -0
  59. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/msinttypes/inttypes.h +0 -0
  60. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/msinttypes/stdint.h +0 -0
  61. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/ostreamwrapper.h +0 -0
  62. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/pointer.h +0 -0
  63. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/prettywriter.h +0 -0
  64. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/rapidjson.h +0 -0
  65. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/reader.h +0 -0
  66. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/schema.h +0 -0
  67. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/stream.h +0 -0
  68. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/stringbuffer.h +0 -0
  69. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/uri.h +0 -0
  70. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/include/rapidjson/writer.h +0 -0
  71. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/license.txt +0 -0
  72. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson/readme.md +0 -0
  73. {python_rapidjson-1.22 → python_rapidjson-1.23}/rapidjson_exact_version.txt +0 -0
  74. {python_rapidjson-1.22 → python_rapidjson-1.23}/requirements-test.txt +0 -0
  75. {python_rapidjson-1.22 → python_rapidjson-1.23}/requirements.txt +0 -0
  76. {python_rapidjson-1.22 → python_rapidjson-1.23}/setup.cfg +0 -0
  77. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/conftest.py +0 -0
  78. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_base_types.py +0 -0
  79. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_circular.py +0 -0
  80. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_dict_subclass.py +0 -0
  81. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_enum.py +0 -0
  82. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_float.py +0 -0
  83. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_memory_leaks.py +0 -0
  84. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_pass1.py +0 -0
  85. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_pass2.py +0 -0
  86. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_pass3.py +0 -0
  87. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_rawjson.py +0 -0
  88. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_refs_count.py +0 -0
  89. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_streams.py +0 -0
  90. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_unicode.py +0 -0
  91. {python_rapidjson-1.22 → python_rapidjson-1.23}/tests/test_validator.py +0 -0
  92. {python_rapidjson-1.22 → python_rapidjson-1.23}/tox.ini +0 -0
  93. {python_rapidjson-1.22 → python_rapidjson-1.23}/typings/rapidjson/__init__.pyi +0 -0
@@ -1,6 +1,15 @@
1
1
  Changes
2
2
  -------
3
3
 
4
+ 1.23 (2025-12-07)
5
+ ~~~~~~~~~~~~~~~~~
6
+
7
+ * Fix serialization bug when using ``MM_COERCE_KEYS_TO_STRINGS`` together with
8
+ ``sort_keys=True`` (`issue #229`__)
9
+
10
+ __ https://github.com/python-rapidjson/python-rapidjson/issues/229
11
+
12
+
4
13
  1.22 (2025-10-21)
5
14
  ~~~~~~~~~~~~~~~~~
6
15
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-rapidjson
3
- Version: 1.22
3
+ Version: 1.23
4
4
  Summary: Python wrapper around rapidjson
5
5
  Home-page: https://github.com/python-rapidjson/python-rapidjson
6
6
  Author: Ken Robbins
@@ -188,6 +188,15 @@ __ https://python-rapidjson.readthedocs.io/en/latest/quickstart.html#incompatibi
188
188
  Changes
189
189
  -------
190
190
 
191
+ 1.23 (2025-12-07)
192
+ ~~~~~~~~~~~~~~~~~
193
+
194
+ * Fix serialization bug when using ``MM_COERCE_KEYS_TO_STRINGS`` together with
195
+ ``sort_keys=True`` (`issue #229`__)
196
+
197
+ __ https://github.com/python-rapidjson/python-rapidjson/issues/229
198
+
199
+
191
200
  1.22 (2025-10-21)
192
201
  ~~~~~~~~~~~~~~~~~
193
202
 
@@ -1,6 +1,15 @@
1
1
  Changes
2
2
  -------
3
3
 
4
+ 1.23 (2025-12-07)
5
+ ~~~~~~~~~~~~~~~~~
6
+
7
+ * Fix serialization bug when using ``MM_COERCE_KEYS_TO_STRINGS`` together with
8
+ ``sort_keys=True`` (`issue #229`__)
9
+
10
+ __ https://github.com/python-rapidjson/python-rapidjson/issues/229
11
+
12
+
4
13
  1.22 (2025-10-21)
5
14
  ~~~~~~~~~~~~~~~~~
6
15
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-rapidjson
3
- Version: 1.22
3
+ Version: 1.23
4
4
  Summary: Python wrapper around rapidjson
5
5
  Home-page: https://github.com/python-rapidjson/python-rapidjson
6
6
  Author: Ken Robbins
@@ -188,6 +188,15 @@ __ https://python-rapidjson.readthedocs.io/en/latest/quickstart.html#incompatibi
188
188
  Changes
189
189
  -------
190
190
 
191
+ 1.23 (2025-12-07)
192
+ ~~~~~~~~~~~~~~~~~
193
+
194
+ * Fix serialization bug when using ``MM_COERCE_KEYS_TO_STRINGS`` together with
195
+ ``sort_keys=True`` (`issue #229`__)
196
+
197
+ __ https://github.com/python-rapidjson/python-rapidjson/issues/229
198
+
199
+
191
200
  1.22 (2025-10-21)
192
201
  ~~~~~~~~~~~~~~~~~
193
202
 
@@ -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 Lele Gaifax
6
+ // :Copyright: © 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025 Lele Gaifax
7
7
  //
8
8
 
9
9
  #include <locale.h>
@@ -2297,23 +2297,17 @@ decoder_new(PyTypeObject* type, PyObject* args, PyObject* kwargs)
2297
2297
 
2298
2298
 
2299
2299
  struct DictItem {
2300
- const char* key_str;
2301
- Py_ssize_t key_size;
2302
- PyObject* item;
2303
-
2304
- DictItem(const char* k,
2305
- Py_ssize_t s,
2306
- PyObject* i)
2307
- : key_str(k),
2308
- key_size(s),
2309
- item(i)
2300
+ std::string key;
2301
+ PyObject* value;
2302
+
2303
+ DictItem(std::string k,
2304
+ PyObject* v)
2305
+ : key(k),
2306
+ value(v)
2310
2307
  {}
2311
2308
 
2312
2309
  bool operator<(const DictItem& other) const {
2313
- Py_ssize_t tks = this->key_size;
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);
2310
+ return key < other.key;
2317
2311
  }
2318
2312
  };
2319
2313
 
@@ -2613,7 +2607,7 @@ dumps_internal(
2613
2607
  return false;
2614
2608
  }
2615
2609
  ASSERT_VALID_SIZE(l);
2616
- items.push_back(DictItem(key_str, l, item));
2610
+ items.push_back(DictItem(std::string(key_str, l), item));
2617
2611
  } else if (!(mappingMode & MM_SKIP_NON_STRING_KEYS)) {
2618
2612
  PyErr_SetString(PyExc_TypeError, "keys must be strings");
2619
2613
  assert(!coercedKey);
@@ -2625,10 +2619,10 @@ dumps_internal(
2625
2619
  std::sort(items.begin(), items.end());
2626
2620
 
2627
2621
  for (size_t i=0, s=items.size(); i < s; i++) {
2628
- writer->Key(items[i].key_str, (SizeType) items[i].key_size);
2622
+ writer->Key(items[i].key.c_str(), (SizeType) items[i].key.length());
2629
2623
  if (Py_EnterRecursiveCall(" while JSONifying dict object"))
2630
2624
  return false;
2631
- bool r = RECURSE(items[i].item);
2625
+ bool r = RECURSE(items[i].value);
2632
2626
  Py_LeaveRecursiveCall();
2633
2627
  if (!r)
2634
2628
  return false;
@@ -44,7 +44,7 @@ else:
44
44
  " want to report the issue.")
45
45
 
46
46
  # Automatically updated by bump-my-version at release time
47
- VERSION = '1.22'
47
+ VERSION = '1.23'
48
48
 
49
49
  with open('README.rst', encoding='utf-8') as f:
50
50
  LONG_DESCRIPTION = f.read()
@@ -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
File without changes
File without changes