GitPedia
Home/PyO3/pyo3/Changelog
PyO3

PyO3/pyo3

Rust bindings for the Python interpreter

30 Releases
Latest: 3d ago
PyO3 0.29.0v0.29.0Latest
davidhewittdavidhewitt·3d ago·June 11, 2026
GitHub

🔒 Security updates

  • With the recent boom in AI-assisted security scanning, PyO3 has inevitably had several correctness issues exposed by AI-assisted scanning.
  • In particular, PyO3 0.29 fixes two security vulnerabilities we will be releasing to the RustSec Advisory Database imminently:
  • Missing `Sync` bound on `PyCFunction::new_closure` closures
  • Possible out of bounds read in `BoundTupleIterator::nth_back` and `BoundListIterator::nth_back`
  • Any code using the above APIs is advised to update as soon as possible.

📦 In closing

  • There are also many other incremental improvements, bug fixes and smaller features; full detail can be found in the [CHANGELOG](https://pyo3.rs/v0.29.0/changelog.html).
  • Please consult the [migration guide](https://pyo3.rs/v0.29.0/migration.html) for help upgrading.
  • Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback. The following contributors' commits are included in this release:
  • @Alc-Alc
  • @alex
  • @anuraaga
  • @BD103
  • @bschoenmaeckers
  • + 28 more
PyO3 0.28.3v0.28.3
davidhewittdavidhewitt·2mo ago·April 2, 2026
GitHub

📋 Changes

  • `Python::attach` and `Python::try_attach` will no longer return before the thread initializing the interpreter has finished runnning `site.py` when using the `auto-initialize` feature.
  • Fix unsoundness in `PyBytesWriter::write_vectored` when targeting the Python 3.15 prerelease interpreter.
  • Fix possible deadlock in `.into_pyobject()` implementation for C-like `#[pyclass]` enums.
PyO3 0.28.2v0.28.2
davidhewittdavidhewitt·3mo ago·February 18, 2026
GitHub

This patch release contains a soundness fix for subclassing native types such as `PyList` with the `abi3` feature enabled when targeting a minimum version of Python 3.12 or higher. (Support for doing such subclassing was newly added in PyO3 0.28.0.) PyO3 0.28.0 and 0.28.1 will be yanked. This release also contains a correction to the FFI definition `PyType_GetTypeDataSize` and incorrectly-generated `__qualname__` on `#[pyclass]` enum variant types when using `#[pyo3(name = "...")]` option to rename the enum and/or variant. Thank you to the following contributors for the improvements: @davidhewitt @Icxolu @ngoldbaum

PyO3 0.28.1v0.28.1
davidhewittdavidhewitt·4mo ago·February 14, 2026
GitHub

This patch contains a number of minor compile-time fixes for PyO3 0.28.0. Thank you to the following contributors for the improvements: @davidhewitt @funsafemath @ngoldbaum @rara64 @tdyas

PyO3 0.28.0v0.28.0
davidhewittdavidhewitt·4mo ago·February 1, 2026
GitHub

📋 Changes

  • Proper support for `__init__` methods for `#[pyclass]` types
  • Support for `#[deleter]`s to complement the existing `#[getter]` and `#[setter]` attributes when implementing class "properties".
  • Support for subclassing many Python types with the `abi3` feature (requires Python 3.12+).
  • A new `#[pyclass(new = "from_fields")]` option to automatically define the constructor from the class fields.
  • Many corrections to FFI definitions (including removal of many private CPython methods)
  • Many improvements to the `experimental-inspect` feature's functionality.
PyO3 0.27.2v0.27.2
davidhewittdavidhewitt·6mo ago·November 30, 2025
GitHub

📋 Changes

  • Workaround a rustc 1.92+ crash compiling PyO3 with both debug assertions and optimizations enabled.
  • Fix runtime crash when subclassing dicts on PyPy and GraalPy.
PyO3 0.27.1v0.27.1
davidhewittdavidhewitt·7mo ago·October 21, 2025
GitHub

This release fixes a clippy lint regression in PyO3 0.27.0, and exposes the `PySendResult` type (the return value from `Bound<PyIterator>::send`). Thank you to the following contributors for the improvements: @alex @davidhewitt @reaperhulk @tpoliaw

PyO3 0.27.0v0.27.0
davidhewittdavidhewitt·7mo ago·October 19, 2025
GitHub

This release is the first PyO3 release to be tested against Python 3.14.0 final. There are no significant changes to 3.14 support since PyO3 0.26 which was tested against the 3.14 release candidates. Support for PyPy 3.9 and PyPy 3.10 (both no longer supported upstream) has been dropped. The `FromPyObject` trait has been reworked in a similar fashion to the `IntoPyObject` trait introduced in PyO3 0.23. This has established a performant and flexible implementation of both these traits and no further changes to the traits are anticipated in the future. Thank you for the patience upgrading through these incremental improvements at the core of PyO3. The `.downcast()` family of functions are now deprecated in favour of the `.cast()` family of functions, which are an incremental improvement to API usability and to error messages on failed conversions. Operations on the `PyCapsule` type have been changed without deprecation to fix some issues with lifetimes of return values (in `.name()` and `.reference()` specifically). The capsule API now also encourages checking of capsule names, which is one of the few defences available to protect the validity of casting data read by the capsule API. There are also many other incremental improvements, bug fixes and smaller features. Please consult the [migration guide](https://pyo3.rs/v0.27.0/migration.html) for help upgrading. Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback. The following contributors' commits are included in this release: @alex @altendky @bazaah @bschoenmaeckers @crepererum @davidhewitt @dependabot[bot] @elbaro @Icxolu @jqnatividad @mbrobbel @NilsIrl @rvben @sanders41 @tdyas @Tpt @vvsagar

PyO3 0.26.0v0.26.0
davidhewittdavidhewitt·9mo ago·August 29, 2025
GitHub

📋 Changes

  • `Python::with_gil` is now known as `Python::attach`
  • `Python::allow_threads` is now known as `Python::detach`
  • `pyo3::prepare_freethreaded_python` is now known as `Python::initialize()`
PyO3 0.25.1v0.25.1
davidhewittdavidhewitt·1y ago·June 12, 2025
GitHub

This release adds testing for arm64 Windows, and fixes a bug with Python 3.14 support on 32-bit systems. This release also adds a `chrono-local` feature to enable support for `chrono::Local` timezone (this was previously available in PyO3 0.24 but would convert the local timezone to a fixed offset, which did not round-trip well). There are a few other fixes, mostly correcting FFI definitions and improving compiler errors when writing `async` code without the `experimental-async` feature enabled. Thank you to the following contributors for the improvements: @bschoenmaeckers @Cheukting @davidhewitt @decathorpe @dependabot[bot] @Icxolu @jessekrubin @musicinmybrain @ngoldbaum @timfel @tonybaloney @Tpt @yogevm15

PyO3 0.25.0v0.25.0
davidhewittdavidhewitt·1y ago·May 14, 2025
GitHub

This version extends Python version support to include the new Python 3.14, currently in beta. Please note it is possible that there may yet be changes to 3.14 before stable release which may impact final compatibility. New optional dependencies on `bigdecimal`, `ordered_float`, and `time` have been added to permit converting types from those crates to Python types (and vice versa). The `experimental-inspect` feature now has the capability to autogenerate type stubs. These stubs are still extremely basic and lack much information. Tooling such as `setuptools-rust` and `maturin` will also need to be updated to make adoption of these easier. Please follow https://github.com/PyO3/pyo3/issues/5137 to keep abreast of developments of this feature. The `#[pyclass]` macro has gained new options `#[pyclass(generic)]` and `#[pyclass(immutable_type)]` to offer additional control over the runtime behaviour of the generated Python type object. The `AsPyPointer` trait has been removed as PyO3's smart pointer types such as `Py<T>`, `Bound<T>` and `Borrowed<T>` covered this use case with a better API. As part of the upgrade to support 3.14, there have also been many cleanups to `pyo3-ffi`. Many definitions which are private implementation details of CPython have been removed; projects downstream of CPython cannot rely on stability of these even across CPython patch releases. There are also many other incremental improvements, bug fixes and smaller features. Please consult the [migration guide](https://pyo3.rs/v0.25.0/migration.html) for help upgrading. Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback. The following contributors' commits are included in this release: @0x676e67 @bschoenmaeckers @clin1234 @davidbrochart @davidhewitt @ddelange @decathorpe @dependabot[bot] @exg @hgmich @Icxolu @IvanIsCoding @m-ou-se @n-eq @ngoldbaum @Owen-CH-Leung @prutschman-iv @superserious-dev @Tpt @trim21 @Vrajs16 @xhochy

PyO3 0.24.2v0.24.2
davidhewittdavidhewitt·1y ago·April 21, 2025
GitHub

This is a small patch release containing minor bugfixes and documentation improvements, including an unused imports lint warning raised from inside PyO3's proc macros. Thank you to the following contributors for the improvements: @davidbrochart @davidhewitt @ddelange @decathorpe @hgmich @Icxolu @n-eq @Tpt @trim21

PyO3 0.24.1v0.24.1
davidhewittdavidhewitt·1y ago·April 1, 2025
GitHub

📋 Changes

  • An `abi3-py313` feature to support compiling with the Python 3.13 stable ABI.
  • `PyAnyMethods::getattr_opt` to get optional attributes without paying the cost of a Python exception when the attribute in question does not exist.
  • Constructor for `PyInt::new`.
  • `with_critical_section2` for locking two objects at the same time on the free-threaded build.
  • Fix for a PyO3 0.24.0 regression with `Option<&str>` and `Option<&T>` (where `T: PyClass`) function arguments no longer being permitted
PyO3 0.24.0v0.24.0
davidhewittdavidhewitt·1y ago·March 9, 2025
GitHub

This release is an incremental improvement of refinements and optimizations following the new APIs established in PyO3's last few releases. Support for `jiff` datetime conversions have been added, and also UUID conversions. The `FromPyObject` derive macro has gained new `#[pyo3(default = ...)]` and `#[pyo3(rename_all = ...)]` options, and the `IntoPyObject` derive macro has gained a new `#[pyo3(into_py_with = ...)]` option. PyO3 will now pass positional arguments to Python functions using the "vectorcall" protocol in many cases, which should be an optimization over the previous behaviour (of creating a Python tuple of positional arguments). Many methods on iterators of Python collections have been optimized. There are also many other incremental improvements, bug fixes and smaller features. Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback. The following contributors' commits are included in this release: @0x676e67 @alex @arielb1 @bschoenmaeckers @davidhewitt @dependabot[bot] @eltociear @Icxolu @IvanIsCoding @JeanArhancet @kahojyun @kemingy @kylebarron @LifeLex @LilyFoote @lundybernard @matt-codecov @mattip @mejrs @messense @msimacek @ngoldbaum @nicolasavru @Owen-CH-Leung @peterjoel @SilverBzH @Tpt @yoav-orca @yotamofek

PyO3 0.23.5v0.23.5
davidhewittdavidhewitt·1y ago·February 25, 2025
GitHub

📋 Changes

  • PyPy 3.11 support
  • Fixes to `#[pyclass(freelist)]` on free-threaded Python 3.13
  • Fix to `Python::run` for a case when `__builtins__` is not loaded correctly on Python 3.10+
PyO3 0.23.4v0.23.4
davidhewittdavidhewitt·1y ago·January 11, 2025
GitHub

📋 Changes

  • Fixes for the new support for free-threaded Python 3.13
  • Fixes to conversions between Python and `chrono` datetimes
  • Fixes to various build configuration cases for Windows
  • Fixes to edge cases in PyO3's macros leading to compile failures
PyO3 0.23.3v0.23.3
davidhewittdavidhewitt·1y ago·December 4, 2024
GitHub

**_This release is a soundness fix for PyO3 0.23.0 through 0.23.2._** In PyO3 0.23.0 the `PYO3_CONFIG_FILE` environment variable used to configure builds regressed such that changing the environment variable would no longer trigger PyO3 to reconfigure and recompile. In combination with workflows using tools such as `maturin` to build for multiple versions in a single build, this leads to Python wheels being compiled against the wrong Python API version. All users who distribute artefacts for multiple Python versions are encouraged to update and rebuild with PyO3 0.23.3. Affected wheels produced from PyO3 0.23.0 through 0.23.2 are highly unstable and will crash the Python interpreter in unpredictable ways. Aside from this fix, PyO3 0.23.3 contains some fixes to link configuration for Python 3.13t on Windows. Thank you to the following contributors for the improvements: @davidhewitt @Icxolu @kemingy

PyO3 0.23.2v0.23.2
davidhewittdavidhewitt·1y ago·November 25, 2024
GitHub

This release fixes a build failure when attempting to compile for free-threaded Python when the `abi3` or `abi3-pyxx` features are enabled. With this fix, the compile will now ignore (with a warning) the `abi3` and `abi3-pyxx` flags (as is the case when compiling for PyPy, as neither support `abi3`). This release also iterates upon the new `IntoPyObject` trait by adding an `IntoPyObjectExt` helper trait with some common convenience functions. Finally, a compile failure related to `ambiguous_associated_items` lint errors inside generated `#[pyclass]` and `#[derive(IntoPyObject)]` output has been fixed. Thank you to the following contributors for the improvements: @davidhewitt @LilyFoote @ngoldbaum

PyO3 0.23.1v0.23.1
davidhewittdavidhewitt·1y ago·November 16, 2024
GitHub

This is a re-release of PyO3 0.23.0 with corrections to fix docs.rs builds. Thanks @yotamofek for the reports & fixes!

PyO3 0.23.0v0.23.0
davidhewittdavidhewitt·1y ago·November 15, 2024
GitHub

📋 Changes

  • Support for Python 3.13t, also known as "free-threaded Python".
  • A new trait `IntoPyObject`, which unifies the existing to-Python conversion traits `IntoPy` and `ToPyObject` while also allowing new optimizations and proper error handling. The new trait also has a `#[derive(IntoPyObject)]` macro.
PyO3 0.22.6v0.22.6
davidhewittdavidhewitt·1y ago·November 5, 2024
GitHub

This release corrects the check for free-threaded Python introduced in PyO3 0.22.2 to prevent users accidentally installing PyO3 packages on Python 3.13t; PyO3 0.22 does not support free-threaded Python. (Stay tuned for the 0.23 release coming very soon!) Thanks @minrk for the report and @davidhewitt for the fix!

PyO3 0.22.5v0.22.5
davidhewittdavidhewitt·1y ago·October 15, 2024
GitHub

This release fixes a compile regression from 0.22.4 where `#[pymethods]` with name `__clear__` and `clear` would generate code with a naming conflict. Thanks @awolverp for the report and @Icxolu for the fix!

PyO3 0.22.4v0.22.4
davidhewittdavidhewitt·1y ago·October 12, 2024
GitHub

📋 Changes

  • A fix for cases where `__traverse__` functions of base types were not called when using `#[pyclass(extends = ...)]`
  • A fix for a regression in 0.22.3 where PyO3 generated code would trigger compile failures with crates using `#![forbid(unsafe_code)]`
PyO3 0.22.3v0.22.3
davidhewittdavidhewitt·1y ago·September 15, 2024
GitHub

This release contains a number of quality improvements building upon PyO3 0.22.2. Python function calls (using `.call0()`, `.call1(args)` and `.call(args, kwargs)`) will now make use of the "vectorcall" calling conventions where possible, which can reduce overheads in many cases. There have been several fix-ups to PyO3's FFI definitions. A new `pyo3::ffi::compat` namespace has been added which offers some backwards-compatible implementations of Python APIs otherwise normally only available on recent Pythons. There have been numerous other bug-fixes and minor tweaks to improve user experience. Thank you to the following contributors for the improvements: @birkenfeld @ChayimFriedman2 @csernazs @davidhewitt @Icxolu @jakelishman @LilyFoote @ngoldbaum @Zyell

PyO3 0.22.2v0.22.2
davidhewittdavidhewitt·1y ago·July 17, 2024
GitHub

This release contains some minor reliability fixes building upon PyO3 0.22.1. As PyO3 is still working on supporting freethreaded Python (upcoming in 3.13), support has been gated behind an `UNSAFE_PYO3_BUILD_FREE_THREADED=1` environment variable to avoid unsuspecting users running into broken builds. Packages built for the `abi3` stable ABI will now use FFI functions for refcounting instead of inline reference count modifications on all versions of the stable ABI (previously only `abi3` builds for 3.12 and up would use FFI functions). This helps mitigate interactions of old versions of the stable ABI with future CPython releases which do more complex reference counting (e.g. immortal objects, freethreaded reference counting). The `#[pymodule]` declarative module now supports directly receiving options. (E.g. `#[pymodule(name = "foo")]`, which would previously have been written as two attributes `#[pymodule] #[pyo3(name = "foo")]`.) A compile error on Rust 1.78 related to use of `c""` literals has been fixed. Thank you to the following contributors for the improvements: @davidhewitt @FlickerSoul @gi0baro @Icxolu @MatthijsKok @styvane

PyO3 0.22.1v0.22.1
davidhewittdavidhewitt·1y ago·July 7, 2024
GitHub

This patch release improves some cases related to new functionality in PyO3 0.22. `PartialEq<bool>` has been added for `Bound<'py, PyBool>`. The `#[pyo3(submodule)]` attribute has been added for declarative modules to stop submodules from generating an external C symbol for importing the submodule directly (which is typically never used). Declarative modules will also now correctly add items annotated with full-path attributes like `#[pyo3::prelude::pyfunction]`. The `#[pyclass(eq)]` option will no longer raise a `TypeError` on comparison against types not in the signature. A `#[setter]` in `#[pymethods]` with an `Option<T>` input will no longer raise a deprecation warning. A regression has been fixed in conversions for 128-bit integers on big-endian platforms. Thank you to the following contributors for the improvements: @alex @davidhewitt @jatoben @kylebarron @musicinmybrain @ngoldbaum @Owen-CH-Leung

PyO3 0.22.0v0.22.0
davidhewittdavidhewitt·1y ago·June 24, 2024
GitHub

📋 Changes

  • The `#[pyclass]` macro now has additional options `#[pyclass(eq, ord, hash)]` to automatically generate Python implementations for equality, ordering and hashing based upon the Rust `PartialEq`, `PartialOrd` and `Hash` traits. This can ensure consistency and reduce boilerplate compared to implementing `__eq__`, `__hash__` and so on manually.
  • The `experimental-declarative-modules` feature to support `#[pymodule]` on Rust `mod` items has been stabilised (and the feature flag removed). The existing implementation of `#[pymodule]` on `fn` items is still present but soft-deprecated; in the future new features will likely be added only to declarative modules, and the `fn` modules may eventually be deprecated and removed.
  • The GIL Refs API deprecation started in PyO3 0.21 continues with all related APIs now being gated behind the `gil-refs` feature, and unconditionally deprecated. In PyO3 0.23 these APIs are expected to be removed.
PyO3 0.21.2v0.21.2
davidhewittdavidhewitt·2y ago·April 16, 2024
GitHub

📋 Changes

  • A missing deprecation warning for the GIL Ref constructor `PySet::empty` has now been added.
  • `#[pymodule]` functions will no longer trigger `missing_docs` lints on their generated code.
  • Incorrect implementations of `__traverse__` in `#[pymethods]` will now emit a better error.
  • Extension modules on AIX will now link to `libpython`.
PyO3 0.21.1v0.21.1
davidhewittdavidhewitt·2y ago·April 1, 2024
GitHub

This release is a set of touch-ups to PyO3 0.21 to fix cases found as adoption of PyO3 0.21.0 progressed. The new `PyBackedStr` and `PyBackedBytes` types have had a large range of standard traits implemented, including `Clone`, `PartialEq`, `Hash`, `PartialOrd`, `Display`, `Debug`, `Send` and `Sync`. The argument to a `#[setter]` function now accepts the full range of input types as any other function argument in a `#[pymethods]` block, and will now correctly handle a `#[pyo3(from_py_with = "...")]` annotation. Some procedural macro output has been adjusted to reuse more code and make it easier to reach complete code coverage in projects using PyO3. The `import_exception_bound!` macro has been added to further assist with coverage during migration, by skipping generating code which is only needed to use the exception as a GIL Ref. Finally, the `experimental-async` feature now correctly handles `async fn` in `#[pymethods]` which have a `&self` or `&mut self` receiver plus additional arguments. Thank you to the following users for the improvements: @alex @davidhewitt @geo7 @Icxolu @reswqa @rikushoney @tisonkun

PyO3 0.21.0v0.21.0
davidhewittdavidhewitt·2y ago·March 25, 2024
GitHub

📋 Changes

  • Support for compiling for GraalPy
  • Extended `chrono` / datetime conversions, including support for the `abi3` feature and the `chrono-tz` crate
  • Simplifications to `__next__` and `__anext__` methods
  • `experimental-async` for a simple `async fn` integration between Rust and Python.
  • `experimental-declarative-modules` for a new simpler `#[pymodule]` syntax.