python-rapidjson 1.19__tar.gz → 1.20__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.19 → python_rapidjson-1.20}/CHANGES.rst +14 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/PKG-INFO +15 -1
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/changes.rst +14 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/validator.rst +3 -3
- {python-rapidjson-1.19 → python_rapidjson-1.20}/python_rapidjson.egg-info/PKG-INFO +15 -1
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson.cpp +40 -15
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_base_types.py +14 -1
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_validator.py +5 -3
- {python-rapidjson-1.19 → python_rapidjson-1.20}/typings/rapidjson/__init__.pyi +4 -4
- python_rapidjson-1.20/version.txt +1 -0
- python-rapidjson-1.19/version.txt +0 -1
- {python-rapidjson-1.19 → python_rapidjson-1.20}/.dir-locals.el +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/LICENSE +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/MANIFEST.in +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/README.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/benchmarks/conftest.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/benchmarks/tablize.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/benchmarks/test_benchmark.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/Makefile +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/api.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/benchmarks-tables.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/benchmarks.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/conf.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/decoder.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/dump.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/dumps.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/encoder.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/index.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/load.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/loads.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/quickstart.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/docs/rawjson.rst +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/python_rapidjson.egg-info/SOURCES.txt +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/python_rapidjson.egg-info/dependency_links.txt +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/python_rapidjson.egg-info/top_level.txt +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/allocators.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/cursorstreamwrapper.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/document.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/encodedstream.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/encodings.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/error/en.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/error/error.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/filereadstream.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/filewritestream.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/fwd.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/biginteger.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/clzll.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/diyfp.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/dtoa.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/ieee754.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/itoa.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/meta.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/pow10.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/regex.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/stack.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/strfunc.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/strtod.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/swap.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/istreamwrapper.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/memorybuffer.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/memorystream.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/msinttypes/inttypes.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/msinttypes/stdint.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/ostreamwrapper.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/pointer.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/prettywriter.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/rapidjson.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/reader.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/schema.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/stream.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/stringbuffer.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/uri.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/writer.h +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/license.txt +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/readme.md +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson_exact_version.txt +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/requirements-test.txt +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/requirements.txt +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/setup.cfg +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/setup.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/conftest.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_circular.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_dict_subclass.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_enum.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_float.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_memory_leaks.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_params.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_pass1.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_pass2.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_pass3.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_rawjson.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_refs_count.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_streams.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tests/test_unicode.py +0 -0
- {python-rapidjson-1.19 → python_rapidjson-1.20}/tox.ini +0 -0
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
Changes
|
|
2
2
|
-------
|
|
3
3
|
|
|
4
|
+
1.20 (2024-08-05)
|
|
5
|
+
~~~~~~~~~~~~~~~~~
|
|
6
|
+
|
|
7
|
+
* Rectify type hints if ``loads()`` and ``Decoder.__call__()`` (`issue #214`__)
|
|
8
|
+
|
|
9
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/214
|
|
10
|
+
|
|
11
|
+
* Ensure ``Validator`` receives valid UTF-8 ``bytes``/``bytearray`` arguments
|
|
12
|
+
|
|
13
|
+
* Generate wheels on PyPI using Python 3.13.0rc1 release, thanks to cibuildwheel `2.20.0`__
|
|
14
|
+
|
|
15
|
+
__ https://cibuildwheel.pypa.io/en/stable/changelog/#v2200
|
|
16
|
+
|
|
17
|
+
|
|
4
18
|
1.19 (2024-07-28)
|
|
5
19
|
~~~~~~~~~~~~~~~~~
|
|
6
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-rapidjson
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.20
|
|
4
4
|
Summary: Python wrapper around rapidjson
|
|
5
5
|
Home-page: https://github.com/python-rapidjson/python-rapidjson
|
|
6
6
|
Author: Ken Robbins
|
|
@@ -155,6 +155,20 @@ __ https://python-rapidjson.readthedocs.io/en/latest/quickstart.html#incompatibi
|
|
|
155
155
|
Changes
|
|
156
156
|
-------
|
|
157
157
|
|
|
158
|
+
1.20 (2024-08-05)
|
|
159
|
+
~~~~~~~~~~~~~~~~~
|
|
160
|
+
|
|
161
|
+
* Rectify type hints if ``loads()`` and ``Decoder.__call__()`` (`issue #214`__)
|
|
162
|
+
|
|
163
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/214
|
|
164
|
+
|
|
165
|
+
* Ensure ``Validator`` receives valid UTF-8 ``bytes``/``bytearray`` arguments
|
|
166
|
+
|
|
167
|
+
* Generate wheels on PyPI using Python 3.13.0rc1 release, thanks to cibuildwheel `2.20.0`__
|
|
168
|
+
|
|
169
|
+
__ https://cibuildwheel.pypa.io/en/stable/changelog/#v2200
|
|
170
|
+
|
|
171
|
+
|
|
158
172
|
1.19 (2024-07-28)
|
|
159
173
|
~~~~~~~~~~~~~~~~~
|
|
160
174
|
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
Changes
|
|
2
2
|
-------
|
|
3
3
|
|
|
4
|
+
1.20 (2024-08-05)
|
|
5
|
+
~~~~~~~~~~~~~~~~~
|
|
6
|
+
|
|
7
|
+
* Rectify type hints if ``loads()`` and ``Decoder.__call__()`` (`issue #214`__)
|
|
8
|
+
|
|
9
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/214
|
|
10
|
+
|
|
11
|
+
* Ensure ``Validator`` receives valid UTF-8 ``bytes``/``bytearray`` arguments
|
|
12
|
+
|
|
13
|
+
* Generate wheels on PyPI using Python 3.13.0rc1 release, thanks to cibuildwheel `2.20.0`__
|
|
14
|
+
|
|
15
|
+
__ https://cibuildwheel.pypa.io/en/stable/changelog/#v2200
|
|
16
|
+
|
|
17
|
+
|
|
4
18
|
1.19 (2024-07-28)
|
|
5
19
|
~~~~~~~~~~~~~~~~~
|
|
6
20
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
.. :Project: python-rapidjson -- Validator class documentation
|
|
3
3
|
.. :Author: Lele Gaifax <lele@metapensiero.it>
|
|
4
4
|
.. :License: MIT License
|
|
5
|
-
.. :Copyright: © 2017, 2018, 2019, 2020 Lele Gaifax
|
|
5
|
+
.. :Copyright: © 2017, 2018, 2019, 2020, 2024 Lele Gaifax
|
|
6
6
|
..
|
|
7
7
|
|
|
8
8
|
=================
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
.. class:: Validator(json_schema)
|
|
19
19
|
|
|
20
20
|
:param json_schema: the `JSON schema`__, specified as a ``str`` instance or an *UTF-8*
|
|
21
|
-
|
|
21
|
+
:class:`bytes`/:class:`bytearray` instance
|
|
22
22
|
:raises JSONDecodeError: if `json_schema` is not a valid ``JSON`` value
|
|
23
23
|
|
|
24
24
|
__ http://json-schema.org/documentation.html
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
.. method:: __call__(json)
|
|
27
27
|
|
|
28
28
|
:param json: the ``JSON`` value, specified as a ``str`` instance or an *UTF-8*
|
|
29
|
-
|
|
29
|
+
:class:`bytes`/:class:`bytearray` instance, that will be validated
|
|
30
30
|
:raises JSONDecodeError: if `json` is not a valid ``JSON`` value
|
|
31
31
|
|
|
32
32
|
The given `json` value will be validated accordingly to the *schema*: a
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-rapidjson
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.20
|
|
4
4
|
Summary: Python wrapper around rapidjson
|
|
5
5
|
Home-page: https://github.com/python-rapidjson/python-rapidjson
|
|
6
6
|
Author: Ken Robbins
|
|
@@ -155,6 +155,20 @@ __ https://python-rapidjson.readthedocs.io/en/latest/quickstart.html#incompatibi
|
|
|
155
155
|
Changes
|
|
156
156
|
-------
|
|
157
157
|
|
|
158
|
+
1.20 (2024-08-05)
|
|
159
|
+
~~~~~~~~~~~~~~~~~
|
|
160
|
+
|
|
161
|
+
* Rectify type hints if ``loads()`` and ``Decoder.__call__()`` (`issue #214`__)
|
|
162
|
+
|
|
163
|
+
__ https://github.com/python-rapidjson/python-rapidjson/issues/214
|
|
164
|
+
|
|
165
|
+
* Ensure ``Validator`` receives valid UTF-8 ``bytes``/``bytearray`` arguments
|
|
166
|
+
|
|
167
|
+
* Generate wheels on PyPI using Python 3.13.0rc1 release, thanks to cibuildwheel `2.20.0`__
|
|
168
|
+
|
|
169
|
+
__ https://cibuildwheel.pypa.io/en/stable/changelog/#v2200
|
|
170
|
+
|
|
171
|
+
|
|
158
172
|
1.19 (2024-07-28)
|
|
159
173
|
~~~~~~~~~~~~~~~~~
|
|
160
174
|
|
|
@@ -2156,8 +2156,9 @@ decoder_call(PyObject* self, PyObject* args, PyObject* kwargs)
|
|
|
2156
2156
|
jsonStr = NULL;
|
|
2157
2157
|
jsonStrLen = 0;
|
|
2158
2158
|
} else {
|
|
2159
|
-
PyErr_SetString(
|
|
2160
|
-
|
|
2159
|
+
PyErr_SetString(
|
|
2160
|
+
PyExc_TypeError,
|
|
2161
|
+
"Expected string or UTF-8 encoded bytes or bytearray or a file-like object");
|
|
2161
2162
|
return NULL;
|
|
2162
2163
|
}
|
|
2163
2164
|
|
|
@@ -3725,17 +3726,24 @@ static PyObject* validator_call(PyObject* self, PyObject* args, PyObject* kwargs
|
|
|
3725
3726
|
return NULL;
|
|
3726
3727
|
|
|
3727
3728
|
const char* jsonStr;
|
|
3729
|
+
PyObject* asUnicode = NULL;
|
|
3728
3730
|
|
|
3729
|
-
if (
|
|
3730
|
-
jsonStr = PyBytes_AsString(jsonObject);
|
|
3731
|
-
if (jsonStr == NULL)
|
|
3732
|
-
return NULL;
|
|
3733
|
-
} else if (PyUnicode_Check(jsonObject)) {
|
|
3731
|
+
if (PyUnicode_Check(jsonObject)) {
|
|
3734
3732
|
jsonStr = PyUnicode_AsUTF8(jsonObject);
|
|
3735
3733
|
if (jsonStr == NULL)
|
|
3736
3734
|
return NULL;
|
|
3735
|
+
} else if (PyBytes_Check(jsonObject) || PyByteArray_Check(jsonObject)) {
|
|
3736
|
+
asUnicode = PyUnicode_FromEncodedObject(jsonObject, "utf-8", NULL);
|
|
3737
|
+
if (asUnicode == NULL)
|
|
3738
|
+
return NULL;
|
|
3739
|
+
jsonStr = PyUnicode_AsUTF8(asUnicode);
|
|
3740
|
+
if (jsonStr == NULL) {
|
|
3741
|
+
Py_DECREF(asUnicode);
|
|
3742
|
+
return NULL;
|
|
3743
|
+
}
|
|
3737
3744
|
} else {
|
|
3738
|
-
PyErr_SetString(PyExc_TypeError,
|
|
3745
|
+
PyErr_SetString(PyExc_TypeError,
|
|
3746
|
+
"Expected string or UTF-8 encoded bytes or bytearray");
|
|
3739
3747
|
return NULL;
|
|
3740
3748
|
}
|
|
3741
3749
|
|
|
@@ -3747,6 +3755,8 @@ static PyObject* validator_call(PyObject* self, PyObject* args, PyObject* kwargs
|
|
|
3747
3755
|
Py_END_ALLOW_THREADS
|
|
3748
3756
|
|
|
3749
3757
|
if (error) {
|
|
3758
|
+
if (asUnicode != NULL)
|
|
3759
|
+
Py_DECREF(asUnicode);
|
|
3750
3760
|
PyErr_SetString(decode_error, "Invalid JSON");
|
|
3751
3761
|
return NULL;
|
|
3752
3762
|
}
|
|
@@ -3758,6 +3768,9 @@ static PyObject* validator_call(PyObject* self, PyObject* args, PyObject* kwargs
|
|
|
3758
3768
|
accept = d.Accept(validator);
|
|
3759
3769
|
Py_END_ALLOW_THREADS
|
|
3760
3770
|
|
|
3771
|
+
if (asUnicode != NULL)
|
|
3772
|
+
Py_DECREF(asUnicode);
|
|
3773
|
+
|
|
3761
3774
|
if (!accept) {
|
|
3762
3775
|
StringBuffer sptr;
|
|
3763
3776
|
StringBuffer dptr;
|
|
@@ -3771,7 +3784,9 @@ static PyObject* validator_call(PyObject* self, PyObject* args, PyObject* kwargs
|
|
|
3771
3784
|
sptr.GetString(), dptr.GetString());
|
|
3772
3785
|
PyErr_SetObject(validation_error, error);
|
|
3773
3786
|
|
|
3774
|
-
|
|
3787
|
+
if (error != NULL)
|
|
3788
|
+
Py_DECREF(error);
|
|
3789
|
+
|
|
3775
3790
|
sptr.Clear();
|
|
3776
3791
|
dptr.Clear();
|
|
3777
3792
|
|
|
@@ -3798,17 +3813,24 @@ static PyObject* validator_new(PyTypeObject* type, PyObject* args, PyObject* kwa
|
|
|
3798
3813
|
return NULL;
|
|
3799
3814
|
|
|
3800
3815
|
const char* jsonStr;
|
|
3816
|
+
PyObject* asUnicode = NULL;
|
|
3801
3817
|
|
|
3802
|
-
if (
|
|
3803
|
-
jsonStr = PyBytes_AsString(jsonObject);
|
|
3804
|
-
if (jsonStr == NULL)
|
|
3805
|
-
return NULL;
|
|
3806
|
-
} else if (PyUnicode_Check(jsonObject)) {
|
|
3818
|
+
if (PyUnicode_Check(jsonObject)) {
|
|
3807
3819
|
jsonStr = PyUnicode_AsUTF8(jsonObject);
|
|
3808
3820
|
if (jsonStr == NULL)
|
|
3809
3821
|
return NULL;
|
|
3822
|
+
} else if (PyBytes_Check(jsonObject) || PyByteArray_Check(jsonObject)) {
|
|
3823
|
+
asUnicode = PyUnicode_FromEncodedObject(jsonObject, "utf-8", NULL);
|
|
3824
|
+
if (asUnicode == NULL)
|
|
3825
|
+
return NULL;
|
|
3826
|
+
jsonStr = PyUnicode_AsUTF8(asUnicode);
|
|
3827
|
+
if (jsonStr == NULL) {
|
|
3828
|
+
Py_DECREF(asUnicode);
|
|
3829
|
+
return NULL;
|
|
3830
|
+
}
|
|
3810
3831
|
} else {
|
|
3811
|
-
PyErr_SetString(PyExc_TypeError,
|
|
3832
|
+
PyErr_SetString(PyExc_TypeError,
|
|
3833
|
+
"Expected string or UTF-8 encoded bytes or bytearray");
|
|
3812
3834
|
return NULL;
|
|
3813
3835
|
}
|
|
3814
3836
|
|
|
@@ -3819,6 +3841,9 @@ static PyObject* validator_new(PyTypeObject* type, PyObject* args, PyObject* kwa
|
|
|
3819
3841
|
error = d.Parse(jsonStr).HasParseError();
|
|
3820
3842
|
Py_END_ALLOW_THREADS
|
|
3821
3843
|
|
|
3844
|
+
if (asUnicode != NULL)
|
|
3845
|
+
Py_DECREF(asUnicode);
|
|
3846
|
+
|
|
3822
3847
|
if (error) {
|
|
3823
3848
|
PyErr_SetString(decode_error, "Invalid JSON");
|
|
3824
3849
|
return NULL;
|
|
@@ -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 Lele Gaifax
|
|
6
|
+
# :Copyright: © 2016, 2017, 2018, 2019, 2020, 2021, 2024 Lele Gaifax
|
|
7
7
|
#
|
|
8
8
|
|
|
9
9
|
import random
|
|
@@ -182,6 +182,19 @@ def test_decode_error(loads):
|
|
|
182
182
|
pytest.raises(rj.JSONDecodeError, loads, '{')
|
|
183
183
|
|
|
184
184
|
|
|
185
|
+
def test_decode_bytes_and_bytearray():
|
|
186
|
+
s = 'FòBàr'
|
|
187
|
+
j = f'"{s}"'
|
|
188
|
+
utf32 = j.encode('utf-32')
|
|
189
|
+
for loader in (rj.loads, rj.Decoder()):
|
|
190
|
+
pytest.raises(UnicodeDecodeError, loader, utf32)
|
|
191
|
+
|
|
192
|
+
utf8 = j.encode('utf-8')
|
|
193
|
+
for loader in (rj.loads, rj.Decoder()):
|
|
194
|
+
for data in (utf8, bytearray(utf8)):
|
|
195
|
+
assert loader(data) == s
|
|
196
|
+
|
|
197
|
+
|
|
185
198
|
def test_shared_keys(loads):
|
|
186
199
|
res = loads('[{"key": "value1"}, {"key": "value2"}]')
|
|
187
200
|
key1, = res[0].keys()
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# :Project: python-rapidjson -- Validator class tests
|
|
3
3
|
# :Author: Lele Gaifax <lele@metapensiero.it>
|
|
4
4
|
# :License: MIT License
|
|
5
|
-
# :Copyright: © 2017, 2019, 2020 Lele Gaifax
|
|
5
|
+
# :Copyright: © 2017, 2019, 2020, 2024 Lele Gaifax
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
import pytest
|
|
@@ -26,8 +26,10 @@ def test_invalid_json():
|
|
|
26
26
|
('{ "type": ["number", "string"] }', '"Life, the universe, and everything"'),
|
|
27
27
|
))
|
|
28
28
|
def test_valid(schema, json):
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
for s in (schema, schema.encode('utf-8'), bytearray(schema.encode('utf-8'))):
|
|
30
|
+
for j in (json, json.encode('utf-8'), bytearray(json.encode('utf-8'))):
|
|
31
|
+
validate = rj.Validator(s)
|
|
32
|
+
validate(j)
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
@pytest.mark.parametrize('schema,json,details', (
|
|
@@ -148,7 +148,7 @@ def load(
|
|
|
148
148
|
allow_nan: t.Optional[bool] = True,
|
|
149
149
|
) -> t.Any: ...
|
|
150
150
|
def loads(
|
|
151
|
-
string: str,
|
|
151
|
+
string: t.Union[str, bytes, bytearray],
|
|
152
152
|
*,
|
|
153
153
|
object_hook: t.Optional[t.Callable[[t.Dict[str, t.Any]], t.Any]] = None,
|
|
154
154
|
number_mode: t.Optional[_NumberMode] = NM_NAN,
|
|
@@ -179,7 +179,7 @@ class Decoder:
|
|
|
179
179
|
) -> None: ...
|
|
180
180
|
def __call__(
|
|
181
181
|
self,
|
|
182
|
-
json: t.Union[str, bytes, t.IO],
|
|
182
|
+
json: t.Union[str, bytes, bytearray, t.IO],
|
|
183
183
|
chunk_size: t.Optional[int] = 65536,
|
|
184
184
|
) -> t.Any: ...
|
|
185
185
|
|
|
@@ -228,5 +228,5 @@ class RawJSON:
|
|
|
228
228
|
|
|
229
229
|
@t.final
|
|
230
230
|
class Validator:
|
|
231
|
-
def __init__(self, json_schema: t.Union[str, bytes]) -> None: ...
|
|
232
|
-
def __call__(self, json: t.Union[str, bytes]) -> None: ...
|
|
231
|
+
def __init__(self, json_schema: t.Union[str, bytes, bytearray]) -> None: ...
|
|
232
|
+
def __call__(self, json: t.Union[str, bytes, bytearray]) -> None: ...
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.20
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.19
|
|
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.19 → python_rapidjson-1.20}/python_rapidjson.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/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.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/filereadstream.h
RENAMED
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/filewritestream.h
RENAMED
|
File without changes
|
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/biginteger.h
RENAMED
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/clzll.h
RENAMED
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/diyfp.h
RENAMED
|
File without changes
|
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/ieee754.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/pow10.h
RENAMED
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/regex.h
RENAMED
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/stack.h
RENAMED
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/strfunc.h
RENAMED
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/internal/strtod.h
RENAMED
|
File without changes
|
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/istreamwrapper.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/msinttypes/inttypes.h
RENAMED
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/rapidjson/include/rapidjson/msinttypes/stdint.h
RENAMED
|
File without changes
|
{python-rapidjson-1.19 → python_rapidjson-1.20}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|