diff --git a/CHANGELOG.md b/CHANGELOG.md index 668fbd23d43..dfcf20e6fa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,34 @@ To see unreleased changes, please see the [CHANGELOG on the main branch guide](h +## [0.23.4] - 2025-01-10 + +### Added + +- Add `PyList::locked_for_each`, which uses a critical section to lock the list on the free-threaded build. [#4789](https://github.com/PyO3/pyo3/pull/4789) +- Add `pyo3_build_config::add_python_framework_link_args` build script API to set rpath when using macOS system Python. [#4833](https://github.com/PyO3/pyo3/pull/4833) + +### Changed + +- Use `datetime.fold` to distinguish ambiguous datetimes when converting to and from `chrono::DateTime` (rather than erroring). [#4791](https://github.com/PyO3/pyo3/pull/4791) +- Optimize PyList iteration on the free-threaded build. [#4789](https://github.com/PyO3/pyo3/pull/4789) + +### Fixed + +- Fix unnecessary internal `py.allow_threads` GIL-switch when attempting to access contents of a `PyErr` which originated from Python (could lead to unintended deadlocks). [#4766](https://github.com/PyO3/pyo3/pull/4766) +- Fix thread-unsafe access of dict internals in `BoundDictIterator` on the free-threaded build. [#4788](https://github.com/PyO3/pyo3/pull/4788) +* Fix unnecessary critical sections in `BoundDictIterator` on the free-threaded build. [#4788](https://github.com/PyO3/pyo3/pull/4788) +- Fix time-of-check to time-of-use issues with list iteration on the free-threaded build. [#4789](https://github.com/PyO3/pyo3/pull/4789) +- Fix `chrono::DateTime` to-Python conversion when `Tz` is `chrono_tz::Tz`. [#4790](https://github.com/PyO3/pyo3/pull/4790) +- Fix `#[pyclass]` not being able to be named `Probe`. [#4794](https://github.com/PyO3/pyo3/pull/4794) +- Fix not treating cross-compilation from x64 to aarch64 on Windows as a cross-compile. [#4800](https://github.com/PyO3/pyo3/pull/4800) +- Fix missing struct fields on GraalPy when subclassing builtin classes. [#4802](https://github.com/PyO3/pyo3/pull/4802) +- Fix generating import lib for PyPy when `abi3` feature is enabled. [#4806](https://github.com/PyO3/pyo3/pull/4806) +- Fix generating import lib for python3.13t when `abi3` feature is enabled. [#4808](https://github.com/PyO3/pyo3/pull/4808) +- Fix compile failure for raw identifiers like `r#box` in `derive(FromPyObject)`. [#4814](https://github.com/PyO3/pyo3/pull/4814) +- Fix compile failure for `#[pyclass]` enum variants with more than 12 fields. [#4832](https://github.com/PyO3/pyo3/pull/4832) + + ## [0.23.3] - 2024-12-03 ### Packaging @@ -2026,7 +2054,8 @@ Yanked - Initial release -[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.23.3...HEAD +[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.23.4...HEAD +[0.23.4]: https://github.com/pyo3/pyo3/compare/v0.23.3...v0.23.4 [0.23.3]: https://github.com/pyo3/pyo3/compare/v0.23.2...v0.23.3 [0.23.2]: https://github.com/pyo3/pyo3/compare/v0.23.1...v0.23.2 [0.23.1]: https://github.com/pyo3/pyo3/compare/v0.23.0...v0.23.1 diff --git a/Cargo.toml b/Cargo.toml index 18cceffbd0c..22c18228c44 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3" -version = "0.23.3" +version = "0.23.4" description = "Bindings to Python interpreter" authors = ["PyO3 Project and Contributors "] readme = "README.md" @@ -21,10 +21,10 @@ memoffset = "0.9" once_cell = "1.13" # ffi bindings to the python interpreter, split into a separate crate so they can be used independently -pyo3-ffi = { path = "pyo3-ffi", version = "=0.23.3" } +pyo3-ffi = { path = "pyo3-ffi", version = "=0.23.4" } # support crates for macros feature -pyo3-macros = { path = "pyo3-macros", version = "=0.23.3", optional = true } +pyo3-macros = { path = "pyo3-macros", version = "=0.23.4", optional = true } indoc = { version = "2.0.1", optional = true } unindent = { version = "0.2.1", optional = true } @@ -66,7 +66,7 @@ static_assertions = "1.1.0" uuid = {version = "1.10.0", features = ["v4"] } [build-dependencies] -pyo3-build-config = { path = "pyo3-build-config", version = "=0.23.3", features = ["resolve-config"] } +pyo3-build-config = { path = "pyo3-build-config", version = "=0.23.4", features = ["resolve-config"] } [features] default = ["macros"] diff --git a/README.md b/README.md index 82b8d390981..ece3524816f 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ name = "string_sum" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.23.3", features = ["extension-module"] } +pyo3 = { version = "0.23.4", features = ["extension-module"] } ``` **`src/lib.rs`** @@ -140,7 +140,7 @@ Start a new project with `cargo new` and add `pyo3` to the `Cargo.toml` like th ```toml [dependencies.pyo3] -version = "0.23.3" +version = "0.23.4" features = ["auto-initialize"] ``` diff --git a/examples/decorator/.template/pre-script.rhai b/examples/decorator/.template/pre-script.rhai index aa83bdd81b7..a4e89a0d054 100644 --- a/examples/decorator/.template/pre-script.rhai +++ b/examples/decorator/.template/pre-script.rhai @@ -1,4 +1,4 @@ -variable::set("PYO3_VERSION", "0.23.3"); +variable::set("PYO3_VERSION", "0.23.4"); file::rename(".template/Cargo.toml", "Cargo.toml"); file::rename(".template/pyproject.toml", "pyproject.toml"); file::delete(".template"); diff --git a/examples/maturin-starter/.template/pre-script.rhai b/examples/maturin-starter/.template/pre-script.rhai index aa83bdd81b7..a4e89a0d054 100644 --- a/examples/maturin-starter/.template/pre-script.rhai +++ b/examples/maturin-starter/.template/pre-script.rhai @@ -1,4 +1,4 @@ -variable::set("PYO3_VERSION", "0.23.3"); +variable::set("PYO3_VERSION", "0.23.4"); file::rename(".template/Cargo.toml", "Cargo.toml"); file::rename(".template/pyproject.toml", "pyproject.toml"); file::delete(".template"); diff --git a/examples/plugin/.template/pre-script.rhai b/examples/plugin/.template/pre-script.rhai index dd76eff3b7b..3a1392912ca 100644 --- a/examples/plugin/.template/pre-script.rhai +++ b/examples/plugin/.template/pre-script.rhai @@ -1,4 +1,4 @@ -variable::set("PYO3_VERSION", "0.23.3"); +variable::set("PYO3_VERSION", "0.23.4"); file::rename(".template/Cargo.toml", "Cargo.toml"); file::rename(".template/plugin_api/Cargo.toml", "plugin_api/Cargo.toml"); file::delete(".template"); diff --git a/examples/setuptools-rust-starter/.template/pre-script.rhai b/examples/setuptools-rust-starter/.template/pre-script.rhai index 461282c2832..6b93bf9e6d1 100644 --- a/examples/setuptools-rust-starter/.template/pre-script.rhai +++ b/examples/setuptools-rust-starter/.template/pre-script.rhai @@ -1,4 +1,4 @@ -variable::set("PYO3_VERSION", "0.23.3"); +variable::set("PYO3_VERSION", "0.23.4"); file::rename(".template/Cargo.toml", "Cargo.toml"); file::rename(".template/setup.cfg", "setup.cfg"); file::delete(".template"); diff --git a/examples/word-count/.template/pre-script.rhai b/examples/word-count/.template/pre-script.rhai index aa83bdd81b7..a4e89a0d054 100644 --- a/examples/word-count/.template/pre-script.rhai +++ b/examples/word-count/.template/pre-script.rhai @@ -1,4 +1,4 @@ -variable::set("PYO3_VERSION", "0.23.3"); +variable::set("PYO3_VERSION", "0.23.4"); file::rename(".template/Cargo.toml", "Cargo.toml"); file::rename(".template/pyproject.toml", "pyproject.toml"); file::delete(".template"); diff --git a/newsfragments/4766.fixed.md b/newsfragments/4766.fixed.md deleted file mode 100644 index 3f69e5d5f63..00000000000 --- a/newsfragments/4766.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix unnecessary internal `py.allow_threads` GIL-switch when attempting to access contents of a `PyErr` which originated from Python (could lead to unintended deadlocks). diff --git a/newsfragments/4788.fixed.md b/newsfragments/4788.fixed.md deleted file mode 100644 index 804cd60fd3d..00000000000 --- a/newsfragments/4788.fixed.md +++ /dev/null @@ -1,4 +0,0 @@ -* Fixed thread-unsafe access of dict internals in BoundDictIterator on the - free-threaded build. -* Avoided creating unnecessary critical sections in BoundDictIterator - implementation on the free-threaded build. diff --git a/newsfragments/4789.added.md b/newsfragments/4789.added.md deleted file mode 100644 index fab564a8962..00000000000 --- a/newsfragments/4789.added.md +++ /dev/null @@ -1,3 +0,0 @@ -* Added `PyList::locked_for_each`, which is equivalent to `PyList::for_each` on - the GIL-enabled build and uses a critical section to lock the list on the - free-threaded build, similar to `PyDict::locked_for_each`. diff --git a/newsfragments/4789.changed.md b/newsfragments/4789.changed.md deleted file mode 100644 index d20419e8f23..00000000000 --- a/newsfragments/4789.changed.md +++ /dev/null @@ -1,2 +0,0 @@ -* Operations that process a PyList via an iterator now use a critical section - on the free-threaded build to amortize synchronization cost and prevent race conditions. diff --git a/newsfragments/4790.fixed.md b/newsfragments/4790.fixed.md deleted file mode 100644 index 9b5e1bf60f1..00000000000 --- a/newsfragments/4790.fixed.md +++ /dev/null @@ -1 +0,0 @@ -fix chrono::DateTime intoPyObject conversion when `Tz` is `chrono_tz::Tz` diff --git a/newsfragments/4791.fixed.md b/newsfragments/4791.fixed.md deleted file mode 100644 index 2aab452eb51..00000000000 --- a/newsfragments/4791.fixed.md +++ /dev/null @@ -1 +0,0 @@ -use `datetime.fold` to distinguish ambiguous datetimes when converting to and from `chrono::DateTime` diff --git a/newsfragments/4794.fixed.md b/newsfragments/4794.fixed.md deleted file mode 100644 index 9076234a5b3..00000000000 --- a/newsfragments/4794.fixed.md +++ /dev/null @@ -1 +0,0 @@ -fix `#[pyclass]` could not be named `Probe` \ No newline at end of file diff --git a/newsfragments/4800.fixed.md b/newsfragments/4800.fixed.md deleted file mode 100644 index 615e622a963..00000000000 --- a/newsfragments/4800.fixed.md +++ /dev/null @@ -1 +0,0 @@ -fix: cross-compilation compatibility checks for Windows diff --git a/newsfragments/4802.fixed.md b/newsfragments/4802.fixed.md deleted file mode 100644 index 55d79c71734..00000000000 --- a/newsfragments/4802.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fixed missing struct fields on GraalPy when subclassing builtin classes diff --git a/newsfragments/4806.fixed.md b/newsfragments/4806.fixed.md deleted file mode 100644 index b5f3d8a554d..00000000000 --- a/newsfragments/4806.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix generating import lib for PyPy when `abi3` feature is enabled. diff --git a/newsfragments/4808.fixed.md b/newsfragments/4808.fixed.md deleted file mode 100644 index 2e7c3a8a23c..00000000000 --- a/newsfragments/4808.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix generating import lib for python3.13t when `abi3` feature is enabled. diff --git a/newsfragments/4814.fixed.md b/newsfragments/4814.fixed.md deleted file mode 100644 index 6634efc2b9f..00000000000 --- a/newsfragments/4814.fixed.md +++ /dev/null @@ -1 +0,0 @@ -`derive(FromPyObject)` support raw identifiers like `r#box`. \ No newline at end of file diff --git a/newsfragments/4832.fixed.md b/newsfragments/4832.fixed.md deleted file mode 100644 index 13df6deae57..00000000000 --- a/newsfragments/4832.fixed.md +++ /dev/null @@ -1 +0,0 @@ -`#[pyclass]` complex enums support more than 12 variant fields. \ No newline at end of file diff --git a/newsfragments/4833.added.md b/newsfragments/4833.added.md deleted file mode 100644 index 4e1e0005305..00000000000 --- a/newsfragments/4833.added.md +++ /dev/null @@ -1 +0,0 @@ -Add `pyo3_build_config::add_python_framework_link_args` build script API to set rpath when using macOS system Python. diff --git a/pyo3-build-config/Cargo.toml b/pyo3-build-config/Cargo.toml index 7c026d03ecf..cee4c3ad52b 100644 --- a/pyo3-build-config/Cargo.toml +++ b/pyo3-build-config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3-build-config" -version = "0.23.3" +version = "0.23.4" description = "Build configuration for the PyO3 ecosystem" authors = ["PyO3 Project and Contributors "] keywords = ["pyo3", "python", "cpython", "ffi"] diff --git a/pyo3-ffi/Cargo.toml b/pyo3-ffi/Cargo.toml index ddbb489e2b9..fe8b3b25513 100644 --- a/pyo3-ffi/Cargo.toml +++ b/pyo3-ffi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3-ffi" -version = "0.23.3" +version = "0.23.4" description = "Python-API bindings for the PyO3 ecosystem" authors = ["PyO3 Project and Contributors "] keywords = ["pyo3", "python", "cpython", "ffi"] @@ -42,7 +42,7 @@ generate-import-lib = ["pyo3-build-config/python3-dll-a"] paste = "1" [build-dependencies] -pyo3-build-config = { path = "../pyo3-build-config", version = "=0.23.3", features = ["resolve-config"] } +pyo3-build-config = { path = "../pyo3-build-config", version = "=0.23.4", features = ["resolve-config"] } [lints] workspace = true diff --git a/pyo3-ffi/README.md b/pyo3-ffi/README.md index 5ae73122501..d220949a875 100644 --- a/pyo3-ffi/README.md +++ b/pyo3-ffi/README.md @@ -41,13 +41,13 @@ name = "string_sum" crate-type = ["cdylib"] [dependencies.pyo3-ffi] -version = "0.23.3" +version = "0.23.4" features = ["extension-module"] [build-dependencies] # This is only necessary if you need to configure your build based on # the Python version or the compile-time configuration for the interpreter. -pyo3_build_config = "0.23.3" +pyo3_build_config = "0.23.4" ``` If you need to use conditional compilation based on Python version or how diff --git a/pyo3-macros-backend/Cargo.toml b/pyo3-macros-backend/Cargo.toml index 38ec968d71d..704c263cb47 100644 --- a/pyo3-macros-backend/Cargo.toml +++ b/pyo3-macros-backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3-macros-backend" -version = "0.23.3" +version = "0.23.4" description = "Code generation for PyO3 package" authors = ["PyO3 Project and Contributors "] keywords = ["pyo3", "python", "cpython", "ffi"] @@ -17,7 +17,7 @@ rust-version = "1.63" [dependencies] heck = "0.5" proc-macro2 = { version = "1.0.60", default-features = false } -pyo3-build-config = { path = "../pyo3-build-config", version = "=0.23.3", features = ["resolve-config"] } +pyo3-build-config = { path = "../pyo3-build-config", version = "=0.23.4", features = ["resolve-config"] } quote = { version = "1", default-features = false } [dependencies.syn] @@ -26,7 +26,7 @@ default-features = false features = ["derive", "parsing", "printing", "clone-impls", "full", "extra-traits"] [build-dependencies] -pyo3-build-config = { path = "../pyo3-build-config", version = "=0.23.3" } +pyo3-build-config = { path = "../pyo3-build-config", version = "=0.23.4" } [lints] workspace = true diff --git a/pyo3-macros/Cargo.toml b/pyo3-macros/Cargo.toml index a44758b37f5..55961376c79 100644 --- a/pyo3-macros/Cargo.toml +++ b/pyo3-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3-macros" -version = "0.23.3" +version = "0.23.4" description = "Proc macros for PyO3 package" authors = ["PyO3 Project and Contributors "] keywords = ["pyo3", "python", "cpython", "ffi"] @@ -22,7 +22,7 @@ experimental-async = ["pyo3-macros-backend/experimental-async"] proc-macro2 = { version = "1.0.60", default-features = false } quote = "1" syn = { version = "2", features = ["full", "extra-traits"] } -pyo3-macros-backend = { path = "../pyo3-macros-backend", version = "=0.23.3" } +pyo3-macros-backend = { path = "../pyo3-macros-backend", version = "=0.23.4" } [lints] workspace = true diff --git a/pyproject.toml b/pyproject.toml index 771e6f8a045..f74a09ed943 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ [tool.towncrier] filename = "CHANGELOG.md" -version = "0.23.3" +version = "0.23.4" start_string = "\n" template = ".towncrier.template.md" title_format = "## [{version}] - {project_date}" diff --git a/tests/ui/reject_generics.stderr b/tests/ui/reject_generics.stderr index 47999f36275..fa5359eeca5 100644 --- a/tests/ui/reject_generics.stderr +++ b/tests/ui/reject_generics.stderr @@ -1,10 +1,10 @@ -error: #[pyclass] cannot have generic parameters. For an explanation, see https://pyo3.rs/v0.23.3/class.html#no-generic-parameters +error: #[pyclass] cannot have generic parameters. For an explanation, see https://pyo3.rs/v0.23.4/class.html#no-generic-parameters --> tests/ui/reject_generics.rs:4:25 | 4 | struct ClassWithGenerics { | ^ -error: #[pyclass] cannot have lifetime parameters. For an explanation, see https://pyo3.rs/v0.23.3/class.html#no-lifetime-parameters +error: #[pyclass] cannot have lifetime parameters. For an explanation, see https://pyo3.rs/v0.23.4/class.html#no-lifetime-parameters --> tests/ui/reject_generics.rs:9:27 | 9 | struct ClassWithLifetimes<'a> {