From 4e24494280c8806952b3feb1bfdc30523d307141 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Fri, 8 Sep 2023 22:45:25 -0500 Subject: [PATCH] Update to 3.9.8. Fixes rhbz#2229530. * Replace Cargo.toml patch that no longer applies with tomcli-set. * Also remove no-panic feature. --- .gitignore | 2 ++ 408.patch | 56 ------------------------------ Remove-unstable-simd-feature.patch | 30 ---------------- python-orjson.spec | 20 ++++++----- sources | 2 +- 5 files changed, 14 insertions(+), 96 deletions(-) delete mode 100644 408.patch delete mode 100644 Remove-unstable-simd-feature.patch diff --git a/.gitignore b/.gitignore index 68fe46f..0c8ff1c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /orjson-3.8.12.tar.gz /orjson-3.8.14.tar.gz /orjson-3.9.2.tar.gz +/orjson-3.9.7.tar.gz +/orjson-3.9.8.tar.gz diff --git a/408.patch b/408.patch deleted file mode 100644 index 1ff0d8f..0000000 --- a/408.patch +++ /dev/null @@ -1,56 +0,0 @@ -From c0d62d041371970297c31ac86465cf8983386191 Mon Sep 17 00:00:00 2001 -From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> -Date: Sun, 23 Jul 2023 17:15:18 +0200 -Subject: [PATCH] Use PyType_GetDict to safely access tp_dict [3.12] - ---- - src/util.rs | 15 ++++++++++++++- - test/test_default.py | 12 ++++++++++++ - 2 files changed, 26 insertions(+), 1 deletion(-) - -diff --git a/src/util.rs b/src/util.rs -index 3b451bd5..ba011c1a 100644 ---- a/src/util.rs -+++ b/src/util.rs -@@ -125,7 +125,20 @@ macro_rules! str_hash { - }; - } - --#[cfg(Py_3_10)] -+#[cfg(Py_3_12)] -+macro_rules! pydict_contains { -+ ($obj1:expr, $obj2:expr) => { -+ unsafe { -+ pyo3_ffi::_PyDict_Contains_KnownHash( -+ pyo3_ffi::PyType_GetDict($obj1), -+ $obj2, -+ (*$obj2.cast::()).hash, -+ ) == 1 -+ } -+ }; -+} -+ -+#[cfg(all(Py_3_10, not(Py_3_12)))] - macro_rules! pydict_contains { - ($obj1:expr, $obj2:expr) => { - unsafe { -diff --git a/test/test_default.py b/test/test_default.py -index d1e95587..547fce8c 100644 ---- a/test/test_default.py -+++ b/test/test_default.py -@@ -275,3 +275,15 @@ def default(obj): - orjson.dumps(ref, default=default) - - assert sys.getrefcount(ref) == 2 # one for ref, one for default -+ -+ def test_default_set(self): -+ """ -+ dumps() default function with set -+ """ -+ -+ def default(obj): -+ if isinstance(obj, set): -+ return list(obj) -+ raise TypeError -+ -+ assert orjson.dumps({1, 2}, default=default) == b"[1,2]" diff --git a/Remove-unstable-simd-feature.patch b/Remove-unstable-simd-feature.patch deleted file mode 100644 index 307ac08..0000000 --- a/Remove-unstable-simd-feature.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 8cb9c84fadfc490ec88665f0ab4871c2d7255738 Mon Sep 17 00:00:00 2001 -From: Maxwell G -Date: Wed, 25 Jan 2023 20:30:13 -0600 -Subject: [PATCH] Remove unstable-simd feature - -This feature requires nightly Rust. ---- - Cargo.toml | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/Cargo.toml b/Cargo.toml -index fbd45a4..09724ce 100644 ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -32,12 +32,6 @@ crate-type = ["cdylib"] - [features] - default = [] - --# Use SIMD intrinsics. This requires Rust on the nightly channel. --unstable-simd = [ -- "bytecount/generic-simd", -- "encoding_rs/simd-accel", --] -- - # Build yyjson as a backend and panic if it fails. The default is to attempt - # to build and on failure fall back to another backend. - yyjson = [] --- -2.40.1 - diff --git a/python-orjson.spec b/python-orjson.spec index 39a7965..f31b29a 100644 --- a/python-orjson.spec +++ b/python-orjson.spec @@ -8,20 +8,15 @@ %bcond tests 1 Name: python-orjson -Version: 3.9.2 -Release: 2%{?dist} +Version: 3.9.8 +Release: 1%{?dist} Summary: Fast, correct Python JSON library License: Apache-2.0 OR MIT URL: https://github.com/ijl/orjson Source: %{pypi_source orjson} -# Compatibility with Python 3.12 -Patch: https://github.com/ijl/orjson/pull/408.patch - -# Ineligble for upstreaming -Patch: Remove-unstable-simd-feature.patch - +BuildRequires: tomcli BuildRequires: python3-devel BuildRequires: %{py3_dist pytest-forked} BuildRequires: rust-packaging @@ -55,13 +50,17 @@ License: %{shrink: %prep %autosetup -p1 -n orjson-%{version} +%cargo_prep +# Remove unstable feature that requires rust nightly +tomcli-set Cargo.toml del 'features.unstable-simd' +# Remove no-panic feature +tomcli-set Cargo.toml del 'features.no-panic' # Remove bundled rust crates rm -r include/cargo .cargo/config.toml # Remove bundled yyjson. rm -rv include/yyjson/ -%cargo_prep %generate_buildrequires @@ -95,6 +94,9 @@ export RUSTFLAGS='%{build_rustflags}' %changelog +* Tue Oct 10 2023 Maxwell G - 3.9.8-1 +- Update to 3.9.8. Fixes rhbz#2229530. + * Tue Jul 25 2023 Tomáš Hrnčiar - 3.9.2-2 - Backport patch to add PyType_GetDict for Python 3.12 - Fixes: rhbz#2220383 diff --git a/sources b/sources index ce12853..2aca32d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (orjson-3.9.2.tar.gz) = 5ac8713c8f921f876e1c6d61daacde5d5b7a738d00f1a0c3f51df2fcb10815de0d73cc980bca43139ddd7fbfca5e800a6d31a35cc833ddb1fac7cdb181a1116f +SHA512 (orjson-3.9.8.tar.gz) = 924810c7f37debdd63398c0f4f63c0543371c227002530d19003c3f37c16a87d8d6aa93267242523d9b6e6ae94e53e6e6a84874f8eeac8ce93a3d088e8e0a4df