Skip to content

Releases: PyO3/pyo3

PyO3 0.29.0

11 Jun 20:57
0f90242

Choose a tag to compare

This release is a relatively large release with improvements across many areas of PyO3's API.

Build and packaging changes

This release brings full support for Python 3.15 beta. We encourage downstream projects to begin testing and distributing Python 3.15 beta wheels so that the ecosystem can prepare for the 3.15 final release later in the year.

Alongside Python 3.15 support comes support for its new "abi3t" stable ABI which supports both free-threaded and gil-enabled Python builds. For projects distributing stable ABI wheels, we recommend distributing (for each OS/architecture) an abi3 wheel built for your minimum supported Python version, a 3.14t version-specific wheel for free-threaded Python 3.14, and an abi3t wheel to support Python 3.15 (and future versions).

Support for Python 3.7 has been dropped. Support for Python 3.13t, the first experimental free-threaded release of CPython, has also been dropped. 3.14t (and soon 3.15t) is more stable, performant, and the starting point for CPython's own declaration of "support" for the free-threaded build.

The PyO3 build process (via the pyo3-build-config crate) has been adjusted to reduce the cost of rebuilds when the environment used to detect the Python interpreter changes; pyo3-build-config and pyo3-macros will no longer be rebuilt in such cases (although pyo3-ffi and crates downstream of it still will be rebuilt). As a consequence the pyo3_build_config APIs now require crates to have a direct dependency on pyo3 or pyo3-ffi. We hope to continue to reduce rebuild frequency and cost in a future PyO3 release.

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.

This release also contains several other minor breaking changes to close soundness holes uncovered by AI-assisted scanning. Our assessment as maintainers was that, excluding the two vulnerability cases listed above, these correctness issues would likely have crashed immediately upon user testing rather than leading to attacker-exploitable pathways. We nevertheless wanted to see them closed without the usual deprecation cycle. These cases are noted in the migration guide.

Other major themes in this release

New in this release is a CLI in pyo3-introspection to generate type stubs along with the experimental-inspect feature. Downstream, maturin has also gained support to generate type stubs using the feature. The feature is reaching a point where substantial amount of type stubs can be generated automatically. We would like to encourage users to begin using this feature and helping us find what functionality is missing, with a hope we can declare its API stable given sufficient feedback.

A substantial amount of effort has been invested in pyo3-ffi as part of the process of extending it with 3.15's new APIs. There have been many missing APIs from older Python versions added. There have also been a number of fixes to incorrect definitions (these are breaking changes, but also necessary for correctness); we hope there will be far fewer such cases in the future due to more comprehensive checking added to PyO3's CI. Finally, many private CPython APIs (those with _Py underscore-named prefix) have been removed from pyo3-ffi's public API.

In closing

There are also many other incremental improvements, bug fixes and smaller features; full detail can be found in the CHANGELOG.

Please consult the migration guide 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
@Cheukting
@chirizxc
@ChristopherRabotin
@clin1234
@codeguru42
@davidhewitt
@dependabot[bot]
@Embers-of-the-Fire
@funsafemath
@Harikeshav-R
@hoodmane
@Icxolu
@IntrepidT
@jelmer
@luxedo
@MatthieuDartiailh
@maurosilber
@mejrs
@messense
@ngoldbaum
@Person-93
@quyentonndbs
@rara64
@staticintlucas
@tbates-redarc
@tdyas
@Tpt
@winstxnhdw

PyO3 0.28.3

02 Apr 09:49

Choose a tag to compare

This patch contains several fixes for stability of the PyO3 0.28.x series:

  • 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.

A couple of edge cases causing compile failures were also fixed.

Thank you to the following contributors for the improvements:

@alex
@bschoenmaeckers
@chirizxc
@davidhewitt
@Embers-of-the-Fire
@Icxolu
@maurosilber
@ngoldbaum

PyO3 0.28.2

18 Feb 10:35

Choose a tag to compare

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.1

14 Feb 13:18

Choose a tag to compare

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.0

01 Feb 22:31
f0c1523

Choose a tag to compare

This release contains many improvements across PyO3's feature set:

  • 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.

The minimum supported Rust version has been increased to Rust 1.83.

This release also switches #[pymodule] to use PEP 489 multi-phase initialization internally. This should have no immediate functional impact other than preparing PyO3 to support newer technologies such as Python subinterpreters.

There are also many other incremental improvements, bug fixes and smaller features; full detail can be found in the CHANGELOG.

Please consult the migration guide 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:

@ABorgna
@ahlinc
@alex
@altendky
@bazaah
@bschoenmaeckers
@chirizxc
@clin1234
@davidhewitt
@dependabot[bot]
@freakboy3742
@henryp3278
@Icxolu
@lazka
@LilyFirefly
@linkmauve
@lmmx
@lukaslueg
@MatthieuDartiailh
@MusicalNinjaDad
@ngoldbaum
@pkalivas
@reaperhulk
@RedKinda
@SilasMarvin
@SoroushMoosapour
@stijndcl
@tpoliaw
@Tpt

PyO3 0.27.2

30 Nov 09:22

Choose a tag to compare

This patch contains very minor fixes for the PyO3 0.27 series:

  • 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.

There are also a number of documentation improvements applied across the codebase.

Thank you to the following contributors for the improvements:

@davidhewitt
@dependabot[bot]
@MusicalNinjaDad
@pkalivas
@tpoliaw
@Tpt

PyO3 0.27.1

21 Oct 20:40

Choose a tag to compare

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.0

19 Oct 11:17
7525512

Choose a tag to compare

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 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.0

29 Aug 13:41
4502c2e

Choose a tag to compare

This version solidifies support for Python 3.14 and free-threaded Python 3.14t. A number of PyO3 APIs have been renamed to reflect the fact the GIL is no longer a universal feature of all Python implementations. For example:

  • 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()

The minimum supported Rust version has been increased to Rust 1.74.

An optional dependency on the bytes crate has been added to allow support for converting bytes::Bytes to / from Python.

The PyObject type alias for Py<PyAny> has also been deprecated; the Py and Bound smart pointers have been the primary interface for all Python-facing types since PyO3 0.21 and the PyObject type alias had been a frequent source of confusion.

There are also many other incremental improvements, bug fixes and smaller features.

Please consult the migration guide 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:

@ahlinc
@alex
@anilbey
@bschoenmaeckers
@Cheukting
@codeguru42
@davidhewitt
@decathorpe
@dependabot[bot]
@drewkett
@FlickerSoul
@Icxolu
@jder
@jessekrubin
@jjmarchewitz
@kemingy
@msimacek
@musicinmybrain
@ngoldbaum
@Nnamdi-sys
@nucccc
@olp-cs
@robsdedude
@rrricharrrd
@sxlijin
@timfel
@tonybaloney
@Tpt
@wxianxin
@xushiyan
@yogevm15

PyO3 0.25.1

12 Jun 21:19

Choose a tag to compare

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