Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-orjson for openSUSE:Factory checked in at 2023-01-03 15:05:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-orjson (Old) and /work/SRC/openSUSE:Factory/.python-orjson.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-orjson" Tue Jan 3 15:05:29 2023 rev:3 rq:1046301 version:3.8.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-orjson/python-orjson.changes 2022-10-29 20:17:57.214481373 +0200 +++ /work/SRC/openSUSE:Factory/.python-orjson.new.1563/python-orjson.changes 2023-01-03 15:05:50.398676068 +0100 @@ -1,0 +2,9 @@ +Mon Jan 2 20:07:26 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 3.8.3: + * `orjson.dumps()` accepts `option=None` per `Optional[int]` type. + * Fix tests on 32-bit for `numpy.intp` and `numpy.uintp`. + * Build now depends on rustc 1.60 or later. + * Support building with maturin 0.13 or 0.14. + +------------------------------------------------------------------- Old: ---- orjson-3.8.1.tar.gz New: ---- orjson-3.8.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-orjson.spec ++++++ --- /var/tmp/diff_new_pack.MYG4tB/_old 2023-01-03 15:05:51.938685056 +0100 +++ /var/tmp/diff_new_pack.MYG4tB/_new 2023-01-03 15:05:51.942685080 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-orjson # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-orjson -Version: 3.8.1 +Version: 3.8.3 Release: 0 Summary: Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy License: Apache-2.0 OR MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.MYG4tB/_old 2023-01-03 15:05:51.982685313 +0100 +++ /var/tmp/diff_new_pack.MYG4tB/_new 2023-01-03 15:05:51.986685337 +0100 @@ -1,6 +1,6 @@ <services> <service name="cargo_vendor" mode="disabled"> - <param name="srctar">orjson-3.8.0.tar.gz</param> + <param name="srctar">orjson-3.8.3.tar.gz</param> <param name="compression">xz</param> <param name="update">true</param> </service> ++++++ orjson-3.8.1.tar.gz -> orjson-3.8.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/CHANGELOG.md new/orjson-3.8.3/CHANGELOG.md --- old/orjson-3.8.1/CHANGELOG.md 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/CHANGELOG.md 2022-12-02 16:26:16.000000000 +0100 @@ -1,5 +1,20 @@ # Changelog +## 3.8.3 - 2022-12-02 + +- `orjson.dumps()` accepts `option=None` per `Optional[int]` type. + +## 3.8.2 - 2022-11-20 + +### Fixed + +- Fix tests on 32-bit for `numpy.intp` and `numpy.uintp`. + +### Changed + +- Build now depends on rustc 1.60 or later. +- Support building with maturin 0.13 or 0.14. + ## 3.8.1 - 2022-10-25 ### Changed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/Cargo.lock new/orjson-3.8.3/Cargo.lock --- old/orjson-3.8.1/Cargo.lock 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/Cargo.lock 2022-12-02 16:26:16.000000000 +0100 @@ -4,9 +4,9 @@ [[package]] name = "ahash" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57e6e951cfbb2db8de1828d49073a113a29fd7117b1596caa781a258c7e38d72" +checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" dependencies = [ "cfg-if", "once_cell", @@ -63,9 +63,9 @@ [[package]] name = "cc" -version = "1.0.73" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" [[package]] name = "cfg-if" @@ -75,9 +75,9 @@ [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "num-integer", "num-traits", @@ -113,9 +113,9 @@ [[package]] name = "libc" -version = "0.2.136" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55edcf6c0bb319052dea84732cf99db461780fd5e8d3eb46ab6ff312ab31f197" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "libm" @@ -144,13 +144,13 @@ [[package]] name = "once_cell" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "orjson" -version = "3.8.1" +version = "3.8.3" dependencies = [ "ahash", "arrayvec", @@ -185,9 +185,9 @@ [[package]] name = "pyo3-build-config" -version = "0.17.2" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf0708c9ed01692635cbf056e286008e5a2927ab1a5e48cdd3aeb1ba5a6fef47" +checksum = "28fcd1e73f06ec85bf3280c48c67e731d8290ad3d730f8be9dc07946923005c8" dependencies = [ "once_cell", "target-lexicon", @@ -195,9 +195,9 @@ [[package]] name = "pyo3-ffi" -version = "0.17.2" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90352dea4f486932b72ddf776264d293f85b79a1d214de1d023927b41461132d" +checksum = "0f6cb136e222e49115b3c51c32792886defbfb0adead26a688142b346a0b9ffc" dependencies = [ "libc", "pyo3-build-config", @@ -217,13 +217,13 @@ [[package]] name = "serde" -version = "1.0.147" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.89" dependencies = [ "itoa", "ryu", @@ -244,9 +244,9 @@ [[package]] name = "target-lexicon" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" +checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" [[package]] name = "version_check" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/Cargo.toml new/orjson-3.8.3/Cargo.toml --- old/orjson-3.8.1/Cargo.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/orjson-3.8.3/Cargo.toml 1970-01-01 01:00:00.000000000 +0100 @@ -1,11 +1,11 @@ [package] name = "orjson" -version = "3.8.1" +version = "3.8.3" authors = ["ijl <i...@mailbox.org>"] description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy" edition = "2021" resolver = "2" -rust-version = "1.57" +rust-version = "1.60" license = "Apache-2.0 OR MIT" repository = "https://github.com/ijl/orjson" homepage = "https://github.com/ijl/orjson" @@ -36,7 +36,6 @@ unstable-simd = [ "bytecount/generic-simd", "encoding_rs/simd-accel", - "simdutf8/aarch64_neon", ] # Build yyjson as a backend and panic if it fails. The default is to attempt @@ -49,7 +48,7 @@ associative-cache = { version = "1", default_features = false } beef = { version = "0.5", default_features = false, features = ["impl_serde"] } bytecount = { version = "^0.6.2", default_features = false, features = ["runtime-dispatch-simd"] } -chrono = { version = "0.4", default_features = false } +chrono = { version = "^0.4.23", default_features = false } compact_str = { version = "0.6", default_features = false, features = ["serde"] } encoding_rs = { version = "0.8", default_features = false } itoa = { version = "1", default_features = false } @@ -58,8 +57,8 @@ ryu = { version = "1", default_features = false } serde = { version = "1", default_features = false } serde_json = { path = "local_dependencies/serde_json", default_features = false, features = ["std", "float_roundtrip"] } -simdutf8 = { version = "0.1", default_features = false, features = ["std"] } -smallvec = { version = "^1.9", default_features = false, features = ["union", "write"] } +simdutf8 = { version = "0.1", default_features = false, features = ["std", "aarch64_neon"] } +smallvec = { version = "^1.10", default_features = false, features = ["union", "write"] } [build-dependencies] cc = { version = "1" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/PKG-INFO new/orjson-3.8.3/PKG-INFO --- old/orjson-3.8.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/orjson-3.8.3/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: orjson -Version: 3.8.1 +Version: 3.8.3 Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License @@ -832,6 +832,11 @@ The array must be a contiguous C array (`C_CONTIGUOUS`) and one of the supported datatypes. +Note a difference between serializing `numpy.float32` using `ndarray.tolist()` +or `orjson.dumps(..., option=orjson.OPT_SERIALIZE_NUMPY)`: `tolist()` converts +to a `double` before serializing and orjson's native path does not. This +can result in different rounding. + `numpy.datetime64` instances are serialized as RFC 3339 strings and datetime options affect them. @@ -853,7 +858,7 @@ b'"2021-01-01T00:00:00+00:00"' ``` -If an array is not a contiguous C array, contains an supported datatype, +If an array is not a contiguous C array, contains an unsupported datatype, or contains a `numpy.datetime64` using an unsupported representation (e.g., picoseconds), orjson falls through to `default`. In `default`, `obj.tolist()` can be specified. If an array is malformed, which @@ -1179,7 +1184,7 @@ ## Packaging -To package orjson requires at least [Rust](https://www.rust-lang.org/) 1.57 +To package orjson requires at least [Rust](https://www.rust-lang.org/) 1.60 and the [maturin](https://github.com/PyO3/maturin) build tool. The recommended build command is: @@ -1191,7 +1196,7 @@ deserialization backend. See this project's `manylinux_2_28` builds for an example using clang and LTO. -The project's own CI tests against `nightly-2022-10-25` and stable 1.57. It +The project's own CI tests against `nightly-2022-11-20` and stable 1.60. It is prudent to pin the nightly version because that channel can introduce breaking changes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/README.md new/orjson-3.8.3/README.md --- old/orjson-3.8.1/README.md 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/README.md 2022-12-02 16:26:16.000000000 +0100 @@ -800,6 +800,11 @@ The array must be a contiguous C array (`C_CONTIGUOUS`) and one of the supported datatypes. +Note a difference between serializing `numpy.float32` using `ndarray.tolist()` +or `orjson.dumps(..., option=orjson.OPT_SERIALIZE_NUMPY)`: `tolist()` converts +to a `double` before serializing and orjson's native path does not. This +can result in different rounding. + `numpy.datetime64` instances are serialized as RFC 3339 strings and datetime options affect them. @@ -821,7 +826,7 @@ b'"2021-01-01T00:00:00+00:00"' ``` -If an array is not a contiguous C array, contains an supported datatype, +If an array is not a contiguous C array, contains an unsupported datatype, or contains a `numpy.datetime64` using an unsupported representation (e.g., picoseconds), orjson falls through to `default`. In `default`, `obj.tolist()` can be specified. If an array is malformed, which @@ -1147,7 +1152,7 @@ ## Packaging -To package orjson requires at least [Rust](https://www.rust-lang.org/) 1.57 +To package orjson requires at least [Rust](https://www.rust-lang.org/) 1.60 and the [maturin](https://github.com/PyO3/maturin) build tool. The recommended build command is: @@ -1159,7 +1164,7 @@ deserialization backend. See this project's `manylinux_2_28` builds for an example using clang and LTO. -The project's own CI tests against `nightly-2022-10-25` and stable 1.57. It +The project's own CI tests against `nightly-2022-11-20` and stable 1.60. It is prudent to pin the nightly version because that channel can introduce breaking changes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/include/json/Cargo.toml new/orjson-3.8.3/include/json/Cargo.toml --- old/orjson-3.8.1/include/json/Cargo.toml 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/include/json/Cargo.toml 2022-12-02 16:26:16.000000000 +0100 @@ -1,6 +1,6 @@ [package] name = "serde_json" -version = "1.0.87" # remember to update html_root_url +version = "1.0.89" # remember to update html_root_url authors = ["Erick Tryzelaar <erick.tryzel...@gmail.com>", "David Tolnay <dtol...@gmail.com>"] categories = ["encoding", "parser-implementations", "no-std"] description = "A JSON serialization file format" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/include/json/src/de.rs new/orjson-3.8.3/include/json/src/de.rs --- old/orjson-3.8.1/include/json/src/de.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/include/json/src/de.rs 2022-12-02 16:26:16.000000000 +0100 @@ -451,30 +451,33 @@ &mut self, positive: bool, mut significand: u64, - mut exponent: i32, + exponent_before_decimal_point: i32, ) -> Result<f64> { self.eat_char(); + let mut exponent_after_decimal_point = 0; while let c @ b'0'..=b'9' = tri!(self.peek_or_null()) { let digit = (c - b'0') as u64; if overflow!(significand * 10 + digit, u64::max_value()) { + let exponent = exponent_before_decimal_point + exponent_after_decimal_point; return self.parse_decimal_overflow(positive, significand, exponent); } self.eat_char(); significand = significand * 10 + digit; - exponent -= 1; + exponent_after_decimal_point -= 1; } // Error if there is not at least one digit after the decimal point. - if exponent == 0 { + if exponent_after_decimal_point == 0 { match tri!(self.peek()) { Some(_) => return Err(self.peek_error(ErrorCode::InvalidNumber)), None => return Err(self.peek_error(ErrorCode::EofWhileParsingValue)), } } + let exponent = exponent_before_decimal_point + exponent_after_decimal_point; match tri!(self.peek_or_null()) { b'e' | b'E' => self.parse_exponent(positive, significand, exponent), _ => self.f64_from_parts(positive, significand, exponent), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/include/json/src/lib.rs new/orjson-3.8.3/include/json/src/lib.rs --- old/orjson-3.8.1/include/json/src/lib.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/include/json/src/lib.rs 2022-12-02 16:26:16.000000000 +0100 @@ -300,7 +300,7 @@ //! [macro]: https://docs.serde.rs/serde_json/macro.json.html //! [`serde-json-core`]: https://github.com/rust-embedded-community/serde-json-core -#![doc(html_root_url = "https://docs.rs/serde_json/1.0.87")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.89")] // Ignored clippy lints #![allow( clippy::collapsible_else_if, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/include/json/src/map.rs new/orjson-3.8.3/include/json/src/map.rs --- old/orjson-3.8.1/include/json/src/map.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/include/json/src/map.rs 2022-12-02 16:26:16.000000000 +0100 @@ -197,9 +197,8 @@ #[inline] pub fn append(&mut self, other: &mut Self) { #[cfg(feature = "preserve_order")] - for (k, v) in mem::replace(&mut other.map, MapImpl::default()) { - self.map.insert(k, v); - } + self.map + .extend(mem::replace(&mut other.map, MapImpl::default())); #[cfg(not(feature = "preserve_order"))] self.map.append(&mut other.map); } @@ -304,6 +303,11 @@ map: self.map.clone(), } } + + #[inline] + fn clone_from(&mut self, source: &Self) { + self.map.clone_from(&source.map); + } } impl PartialEq for Map<String, Value> { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/include/json/src/ser.rs new/orjson-3.8.3/include/json/src/ser.rs --- old/orjson-3.8.1/include/json/src/ser.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/include/json/src/ser.rs 2022-12-02 16:26:16.000000000 +0100 @@ -2017,7 +2017,7 @@ } } -#[cold] +#[inline(never)] fn format_escaped_str_with_escapes<W, F>( writer: &mut W, formatter: &mut F, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/include/json/src/value/de.rs new/orjson-3.8.3/include/json/src/value/de.rs --- old/orjson-3.8.1/include/json/src/value/de.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/include/json/src/value/de.rs 2022-12-02 16:26:16.000000000 +0100 @@ -994,7 +994,7 @@ V: Visitor<'de>, { match self.value { - Some(&Value::Array(ref v)) => { + Some(Value::Array(v)) => { if v.is_empty() { visitor.visit_unit() } else { @@ -1021,7 +1021,7 @@ V: Visitor<'de>, { match self.value { - Some(&Value::Object(ref v)) => visit_object_ref(v, visitor), + Some(Value::Object(v)) => visit_object_ref(v, visitor), Some(other) => Err(serde::de::Error::invalid_type( other.unexpected(), &"struct variant", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/local_dependencies/serde_json/Cargo.toml new/orjson-3.8.3/local_dependencies/serde_json/Cargo.toml --- old/orjson-3.8.1/local_dependencies/serde_json/Cargo.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/orjson-3.8.3/local_dependencies/serde_json/Cargo.toml 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ [package] name = "serde_json" -version = "1.0.87" # remember to update html_root_url +version = "1.0.89" # remember to update html_root_url authors = ["Erick Tryzelaar <erick.tryzel...@gmail.com>", "David Tolnay <dtol...@gmail.com>"] categories = ["encoding", "parser-implementations", "no-std"] description = "A JSON serialization file format" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/local_dependencies/serde_json/src/de.rs new/orjson-3.8.3/local_dependencies/serde_json/src/de.rs --- old/orjson-3.8.1/local_dependencies/serde_json/src/de.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/local_dependencies/serde_json/src/de.rs 2022-12-02 16:26:16.000000000 +0100 @@ -451,30 +451,33 @@ &mut self, positive: bool, mut significand: u64, - mut exponent: i32, + exponent_before_decimal_point: i32, ) -> Result<f64> { self.eat_char(); + let mut exponent_after_decimal_point = 0; while let c @ b'0'..=b'9' = tri!(self.peek_or_null()) { let digit = (c - b'0') as u64; if overflow!(significand * 10 + digit, u64::max_value()) { + let exponent = exponent_before_decimal_point + exponent_after_decimal_point; return self.parse_decimal_overflow(positive, significand, exponent); } self.eat_char(); significand = significand * 10 + digit; - exponent -= 1; + exponent_after_decimal_point -= 1; } // Error if there is not at least one digit after the decimal point. - if exponent == 0 { + if exponent_after_decimal_point == 0 { match tri!(self.peek()) { Some(_) => return Err(self.peek_error(ErrorCode::InvalidNumber)), None => return Err(self.peek_error(ErrorCode::EofWhileParsingValue)), } } + let exponent = exponent_before_decimal_point + exponent_after_decimal_point; match tri!(self.peek_or_null()) { b'e' | b'E' => self.parse_exponent(positive, significand, exponent), _ => self.f64_from_parts(positive, significand, exponent), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/local_dependencies/serde_json/src/lib.rs new/orjson-3.8.3/local_dependencies/serde_json/src/lib.rs --- old/orjson-3.8.1/local_dependencies/serde_json/src/lib.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/local_dependencies/serde_json/src/lib.rs 2022-12-02 16:26:16.000000000 +0100 @@ -300,7 +300,7 @@ //! [macro]: https://docs.serde.rs/serde_json/macro.json.html //! [`serde-json-core`]: https://github.com/rust-embedded-community/serde-json-core -#![doc(html_root_url = "https://docs.rs/serde_json/1.0.87")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.89")] // Ignored clippy lints #![allow( clippy::collapsible_else_if, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/local_dependencies/serde_json/src/map.rs new/orjson-3.8.3/local_dependencies/serde_json/src/map.rs --- old/orjson-3.8.1/local_dependencies/serde_json/src/map.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/local_dependencies/serde_json/src/map.rs 2022-12-02 16:26:16.000000000 +0100 @@ -197,9 +197,8 @@ #[inline] pub fn append(&mut self, other: &mut Self) { #[cfg(feature = "preserve_order")] - for (k, v) in mem::replace(&mut other.map, MapImpl::default()) { - self.map.insert(k, v); - } + self.map + .extend(mem::replace(&mut other.map, MapImpl::default())); #[cfg(not(feature = "preserve_order"))] self.map.append(&mut other.map); } @@ -304,6 +303,11 @@ map: self.map.clone(), } } + + #[inline] + fn clone_from(&mut self, source: &Self) { + self.map.clone_from(&source.map); + } } impl PartialEq for Map<String, Value> { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/local_dependencies/serde_json/src/ser.rs new/orjson-3.8.3/local_dependencies/serde_json/src/ser.rs --- old/orjson-3.8.1/local_dependencies/serde_json/src/ser.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/local_dependencies/serde_json/src/ser.rs 2022-12-02 16:26:16.000000000 +0100 @@ -2017,7 +2017,7 @@ } } -#[cold] +#[inline(never)] fn format_escaped_str_with_escapes<W, F>( writer: &mut W, formatter: &mut F, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/local_dependencies/serde_json/src/value/de.rs new/orjson-3.8.3/local_dependencies/serde_json/src/value/de.rs --- old/orjson-3.8.1/local_dependencies/serde_json/src/value/de.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/local_dependencies/serde_json/src/value/de.rs 2022-12-02 16:26:16.000000000 +0100 @@ -994,7 +994,7 @@ V: Visitor<'de>, { match self.value { - Some(&Value::Array(ref v)) => { + Some(Value::Array(v)) => { if v.is_empty() { visitor.visit_unit() } else { @@ -1021,7 +1021,7 @@ V: Visitor<'de>, { match self.value { - Some(&Value::Object(ref v)) => visit_object_ref(v, visitor), + Some(Value::Object(v)) => visit_object_ref(v, visitor), Some(other) => Err(serde::de::Error::invalid_type( other.unexpected(), &"struct variant", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/pyproject.toml new/orjson-3.8.3/pyproject.toml --- old/orjson-3.8.1/pyproject.toml 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/pyproject.toml 2022-12-02 16:26:16.000000000 +0100 @@ -24,7 +24,7 @@ [build-system] build-backend = "maturin" -requires = ["maturin>=0.13,<0.14"] +requires = ["maturin>=0.13,<0.15"] [tool.maturin] sdist-include = ["build.rs", "Cargo.lock", "include/**/*"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/src/deserialize/utf8.rs new/orjson-3.8.3/src/deserialize/utf8.rs --- old/orjson-3.8.1/src/deserialize/utf8.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/src/deserialize/utf8.rs 2022-12-02 16:26:16.000000000 +0100 @@ -8,7 +8,7 @@ use std::borrow::Cow; use std::os::raw::c_char; -#[cfg(target_arch = "x86_64")] +#[cfg(all(target_arch = "x86_64", not(target_feature = "sse4.2")))] fn is_valid_utf8(buf: &[u8]) -> bool { if std::is_x86_feature_detected!("sse4.2") { simdutf8::basic::from_utf8(buf).is_ok() @@ -17,6 +17,11 @@ } } +#[cfg(all(target_arch = "x86_64", target_feature = "sse4.2"))] +fn is_valid_utf8(buf: &[u8]) -> bool { + simdutf8::basic::from_utf8(buf).is_ok() +} + #[cfg(target_arch = "aarch64")] fn is_valid_utf8(buf: &[u8]) -> bool { simdutf8::basic::from_utf8(buf).is_ok() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/src/lib.rs new/orjson-3.8.3/src/lib.rs --- old/orjson-3.8.1/src/lib.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/src/lib.rs 2022-12-02 16:26:16.000000000 +0100 @@ -3,6 +3,7 @@ #![cfg_attr(feature = "intrinsics", feature(core_intrinsics))] #![cfg_attr(feature = "optimize", feature(optimize_attribute))] #![allow(unused_unsafe)] +#![allow(clippy::explicit_auto_deref)] #![allow(clippy::missing_safety_doc)] #![allow(clippy::redundant_field_names)] #![allow(clippy::unnecessary_unwrap)] @@ -323,12 +324,14 @@ let mut optsbits: i32 = 0; if let Some(opts) = optsptr { - if (*opts.as_ptr()).ob_type != typeref::INT_TYPE { - return raise_dumps_exception(Cow::Borrowed("Invalid opts")); - } - optsbits = PyLong_AsLong(optsptr.unwrap().as_ptr()) as i32; - if !(0..=opt::MAX_OPT).contains(&optsbits) { + if opts.as_ptr() == typeref::NONE { + } else if (*opts.as_ptr()).ob_type != typeref::INT_TYPE { return raise_dumps_exception(Cow::Borrowed("Invalid opts")); + } else { + optsbits = PyLong_AsLong(optsptr.unwrap().as_ptr()) as i32; + if !(0..=opt::MAX_OPT).contains(&optsbits) { + return raise_dumps_exception(Cow::Borrowed("Invalid opts")); + } } } @@ -391,12 +394,14 @@ let mut optsbits: i32 = 0; if let Some(opts) = optsptr { - if (*opts.as_ptr()).ob_type != typeref::INT_TYPE { - return raise_dumps_exception(Cow::Borrowed("Invalid opts")); - } - optsbits = PyLong_AsLong(optsptr.unwrap().as_ptr()) as i32; - if optsbits < 0 || optsbits > opt::MAX_OPT { + if opts.as_ptr() == typeref::NONE { + } else if (*opts.as_ptr()).ob_type != typeref::INT_TYPE { return raise_dumps_exception(Cow::Borrowed("Invalid opts")); + } else { + optsbits = PyLong_AsLong(optsptr.unwrap().as_ptr()) as i32; + if !(0..=opt::MAX_OPT).contains(&optsbits) { + return raise_dumps_exception(Cow::Borrowed("Invalid opts")); + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/src/serialize/datetime.rs new/orjson-3.8.3/src/serialize/datetime.rs --- old/orjson-3.8.1/src/serialize/datetime.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/src/serialize/datetime.rs 2022-12-02 16:26:16.000000000 +0100 @@ -39,7 +39,7 @@ } pub fn write_buf(&self, buf: &mut DateTimeBuffer) { { - let year = ffi!(PyDateTime_GET_YEAR(self.ptr)) as i32; + let year = ffi!(PyDateTime_GET_YEAR(self.ptr)); let mut yearbuf = itoa::Buffer::new(); let formatted = yearbuf.format(year); if unlikely!(year < 1000) { @@ -171,7 +171,7 @@ // pendulum let py_offset = call_method!(self.ptr, UTCOFFSET_METHOD_STR); let offset = Offset { - second: ffi!(PyDateTime_DELTA_GET_SECONDS(py_offset)) as i32, + second: ffi!(PyDateTime_DELTA_GET_SECONDS(py_offset)), day: ffi!(PyDateTime_DELTA_GET_DAYS(py_offset)), }; ffi!(Py_DECREF(py_offset)); @@ -182,7 +182,7 @@ let py_offset = call_method!(method_ptr, UTCOFFSET_METHOD_STR); ffi!(Py_DECREF(method_ptr)); let offset = Offset { - second: ffi!(PyDateTime_DELTA_GET_SECONDS(py_offset)) as i32, + second: ffi!(PyDateTime_DELTA_GET_SECONDS(py_offset)), day: ffi!(PyDateTime_DELTA_GET_DAYS(py_offset)), }; ffi!(Py_DECREF(py_offset)); @@ -191,7 +191,7 @@ // dateutil/arrow, datetime.timezone.utc let py_offset = call_method!(tzinfo, UTCOFFSET_METHOD_STR, self.ptr); let offset = Offset { - second: ffi!(PyDateTime_DELTA_GET_SECONDS(py_offset)) as i32, + second: ffi!(PyDateTime_DELTA_GET_SECONDS(py_offset)), day: ffi!(PyDateTime_DELTA_GET_DAYS(py_offset)), }; ffi!(Py_DECREF(py_offset)); @@ -211,7 +211,7 @@ // zoneinfo let py_offset = call_method!(tzinfo, UTCOFFSET_METHOD_STR, self.ptr); let offset = Offset { - second: ffi!(PyDateTime_DELTA_GET_SECONDS(py_offset)) as i32, + second: ffi!(PyDateTime_DELTA_GET_SECONDS(py_offset)), day: ffi!(PyDateTime_DELTA_GET_DAYS(py_offset)), }; ffi!(Py_DECREF(py_offset)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/src/serialize/dict.rs new/orjson-3.8.3/src/serialize/dict.rs --- old/orjson-3.8.1/src/serialize/dict.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/src/serialize/dict.rs 2022-12-02 16:26:16.000000000 +0100 @@ -160,7 +160,6 @@ } fn pyobject_to_string( - &self, key: *mut pyo3_ffi::PyObject, opts: crate::opt::Opt, ) -> Result<CompactString, SerializeError> { @@ -228,7 +227,7 @@ ObType::Enum => { let value = ffi!(PyObject_GetAttr(key, VALUE_STR)); ffi!(Py_DECREF(value)); - self.pyobject_to_string(value, opts) + Self::pyobject_to_string(value, opts) } ObType::Str => { // because of ObType::Enum @@ -276,7 +275,7 @@ } items.push((CompactString::from(uni.unwrap()), value)); } else { - match self.pyobject_to_string(key, opts) { + match Self::pyobject_to_string(key, opts) { Ok(key_as_str) => items.push((key_as_str, value)), Err(err) => err!(err), } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/src/serialize/list.rs new/orjson-3.8.3/src/serialize/list.rs --- old/orjson-3.8.1/src/serialize/list.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/src/serialize/list.rs 2022-12-02 16:26:16.000000000 +0100 @@ -42,9 +42,8 @@ } else { let mut seq = serializer.serialize_seq(None).unwrap(); for i in 0..=ffi!(Py_SIZE(self.ptr)) as usize - 1 { - let elem = unsafe { - *((*(self.ptr as *mut pyo3_ffi::PyListObject)).ob_item).offset(i as isize) - }; + let elem = + unsafe { *((*(self.ptr as *mut pyo3_ffi::PyListObject)).ob_item).add(i) }; let value = PyObjectSerializer::new( elem, self.opts, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/src/serialize/numpy.rs new/orjson-3.8.3/src/serialize/numpy.rs --- old/orjson-3.8.1/src/serialize/numpy.rs 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/src/serialize/numpy.rs 2022-12-02 16:26:16.000000000 +0100 @@ -546,7 +546,7 @@ #[repr(transparent)] pub struct DataTypeU16 { - obj: u16 + obj: u16, } impl Serialize for DataTypeU16 { @@ -672,7 +672,6 @@ } } - #[repr(transparent)] struct NumpyI8Array<'a> { data: &'a [i8], @@ -867,7 +866,7 @@ pub value: i16, } -impl<'p> Serialize for NumpyInt16 { +impl Serialize for NumpyInt16 { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, @@ -931,7 +930,7 @@ pub value: u16, } -impl<'p> Serialize for NumpyUint16 { +impl Serialize for NumpyUint16 { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, @@ -1135,15 +1134,17 @@ /// Returns an `Err(NumpyDateTimeError)` if the value is invalid for this unit. fn datetime(&self, val: i64, opts: Opt) -> Result<NumpyDatetime64Repr, NumpyDateTimeError> { match self { - Self::Years => Ok(NaiveDate::from_ymd( + Self::Years => Ok(NaiveDate::from_ymd_opt( (val + 1970) .try_into() .map_err(|_| NumpyDateTimeError::Unrepresentable { unit: *self, val })?, 1, 1, ) - .and_hms(0, 0, 0)), - Self::Months => Ok(NaiveDate::from_ymd( + .unwrap() + .and_hms_opt(0, 0, 0) + .unwrap()), + Self::Months => Ok(NaiveDate::from_ymd_opt( (val / 12 + 1970) .try_into() .map_err(|_| NumpyDateTimeError::Unrepresentable { unit: *self, val })?, @@ -1152,30 +1153,37 @@ .map_err(|_| NumpyDateTimeError::Unrepresentable { unit: *self, val })?, 1, ) - .and_hms(0, 0, 0)), - Self::Weeks => Ok(NaiveDateTime::from_timestamp(val * 7 * 24 * 60 * 60, 0)), - Self::Days => Ok(NaiveDateTime::from_timestamp(val * 24 * 60 * 60, 0)), - Self::Hours => Ok(NaiveDateTime::from_timestamp(val * 60 * 60, 0)), - Self::Minutes => Ok(NaiveDateTime::from_timestamp(val * 60, 0)), - Self::Seconds => Ok(NaiveDateTime::from_timestamp(val, 0)), - Self::Milliseconds => Ok(NaiveDateTime::from_timestamp( + .unwrap() + .and_hms_opt(0, 0, 0) + .unwrap()), + Self::Weeks => { + Ok(NaiveDateTime::from_timestamp_opt(val * 7 * 24 * 60 * 60, 0).unwrap()) + } + Self::Days => Ok(NaiveDateTime::from_timestamp_opt(val * 24 * 60 * 60, 0).unwrap()), + Self::Hours => Ok(NaiveDateTime::from_timestamp_opt(val * 60 * 60, 0).unwrap()), + Self::Minutes => Ok(NaiveDateTime::from_timestamp_opt(val * 60, 0).unwrap()), + Self::Seconds => Ok(NaiveDateTime::from_timestamp_opt(val, 0).unwrap()), + Self::Milliseconds => Ok(NaiveDateTime::from_timestamp_opt( val / 1_000, (val % 1_000 * 1_000_000) .try_into() .map_err(|_| NumpyDateTimeError::Unrepresentable { unit: *self, val })?, - )), - Self::Microseconds => Ok(NaiveDateTime::from_timestamp( + ) + .unwrap()), + Self::Microseconds => Ok(NaiveDateTime::from_timestamp_opt( val / 1_000_000, (val % 1_000_000 * 1_000) .try_into() .map_err(|_| NumpyDateTimeError::Unrepresentable { unit: *self, val })?, - )), - Self::Nanoseconds => Ok(NaiveDateTime::from_timestamp( + ) + .unwrap()), + Self::Nanoseconds => Ok(NaiveDateTime::from_timestamp_opt( val / 1_000_000_000, (val % 1_000_000_000) .try_into() .map_err(|_| NumpyDateTimeError::Unrepresentable { unit: *self, val })?, - )), + ) + .unwrap()), _ => Err(NumpyDateTimeError::UnsupportedUnit(*self)), } .map(|dt| NumpyDatetime64Repr { dt, opts }) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/test/test_api.py new/orjson-3.8.3/test/test_api.py --- old/orjson-3.8.1/test/test_api.py 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/test/test_api.py 2022-12-02 16:26:16.000000000 +0100 @@ -69,6 +69,15 @@ pytest.raises(orjson.JSONDecodeError, orjson.loads, "{") pytest.raises(ValueError, orjson.loads, "{") + def test_optional_none(self): + """ + dumps() option, default None + """ + assert orjson.dumps([], option=None) == b"[]" + assert orjson.dumps([], default=None) == b"[]" + assert orjson.dumps([], option=None, default=None) == b"[]" + assert orjson.dumps([], None, None) == b"[]" + def test_option_not_int(self): """ dumps() option not int or None @@ -173,6 +182,7 @@ ) inspect.signature(orjson.dumps).bind("str") inspect.signature(orjson.dumps).bind("str", default=default, option=1) + inspect.signature(orjson.dumps).bind("str", default=None, option=None) def test_loads_signature(self): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orjson-3.8.1/test/test_numpy.py new/orjson-3.8.3/test/test_numpy.py --- old/orjson-3.8.1/test/test_numpy.py 2022-10-25 17:39:38.000000000 +0200 +++ new/orjson-3.8.3/test/test_numpy.py 2022-12-02 16:26:16.000000000 +0100 @@ -18,22 +18,20 @@ @pytest.mark.skipif(numpy is None, reason="numpy is not installed") class TestNumpy: def test_numpy_array_d1_uintp(self): - assert ( - orjson.dumps( - numpy.array([0, 18446744073709551615], numpy.uintp), - option=orjson.OPT_SERIALIZE_NUMPY, - ) - == b"[0,18446744073709551615]" - ) + low = numpy.iinfo(numpy.uintp).min + high = numpy.iinfo(numpy.uintp).max + assert orjson.dumps( + numpy.array([low, high], numpy.uintp), + option=orjson.OPT_SERIALIZE_NUMPY, + ) == f"[{low},{high}]".encode("ascii") def test_numpy_array_d1_intp(self): - assert ( - orjson.dumps( - numpy.array([-9223372036854775807, 9223372036854775807], numpy.intp), - option=orjson.OPT_SERIALIZE_NUMPY, - ) - == b"[-9223372036854775807,9223372036854775807]" - ) + low = numpy.iinfo(numpy.intp).min + high = numpy.iinfo(numpy.intp).max + assert orjson.dumps( + numpy.array([low, high], numpy.intp), + option=orjson.OPT_SERIALIZE_NUMPY, + ) == f"[{low},{high}]".encode("ascii") def test_numpy_array_d1_i64(self): assert ( @@ -720,3 +718,57 @@ ) == b"[[[1,2],[3,4],[5,6],[7,8]]]" ) + + +@pytest.mark.skipif(numpy is None, reason="numpy is not installed") +class TestNumpyEquivalence: + def _test(self, obj): + assert orjson.dumps(obj, option=orjson.OPT_SERIALIZE_NUMPY) == orjson.dumps( + obj.tolist() + ) + + def test_numpy_uint8(self): + self._test(numpy.array([0, 255], numpy.uint8)) + + def test_numpy_uint16(self): + self._test(numpy.array([0, 65535], numpy.uint16)) + + def test_numpy_uint32(self): + self._test(numpy.array([0, 4294967295], numpy.uint32)) + + def test_numpy_uint64(self): + self._test(numpy.array([0, 18446744073709551615], numpy.uint64)) + + def test_numpy_int8(self): + self._test(numpy.array([-128, 127], numpy.int8)) + + def test_numpy_int16(self): + self._test(numpy.array([-32768, 32767], numpy.int16)) + + def test_numpy_int32(self): + self._test(numpy.array([-2147483647, 2147483647], numpy.int32)) + + def test_numpy_int64(self): + self._test( + numpy.array([-9223372036854775807, 9223372036854775807], numpy.int64) + ) + + @pytest.mark.skip(reason="tolist() conversion results in 3.4028234663852886e38") + def test_numpy_float32(self): + self._test( + numpy.array( + [ + -340282346638528859811704183484516925440.0000000000000000, + 340282346638528859811704183484516925440.0000000000000000, + ], + numpy.float32, + ) + ) + self._test(numpy.array([-3.4028235e38, 3.4028235e38], numpy.float32)) + + def test_numpy_float64(self): + self._test( + numpy.array( + [-1.7976931348623157e308, 1.7976931348623157e308], numpy.float64 + ) + ) ++++++ vendor.tar.xz ++++++ ++++ 42987 lines of diff (skipped)