Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ To see unreleased changes, please see the [CHANGELOG on the main branch guide](h

<!-- towncrier release notes start -->

## [0.28.2] - 2026-02-18

### Fixed

- Fix complex enum `__qualname__` not using python name [#5815](https://github.com/PyO3/pyo3/pull/5815)
- Fix FFI definition `PyType_GetTypeDataSize` (was incorrectly named `PyObject_GetTypeDataSize`). [#5819](https://github.com/PyO3/pyo3/pull/5819)
- Fix memory corruption when subclassing native types with `abi3` feature on Python 3.12+ (newly enabled in PyO3 0.28.0). [#5823](https://github.com/PyO3/pyo3/pull/5823)

## [0.28.1] - 2026-02-14

### Fixed
Expand All @@ -18,6 +26,7 @@ To see unreleased changes, please see the [CHANGELOG on the main branch guide](h
- Fix `clippy::declare_interior_mutable_const` warning inside `#[pyclass]` generated code on enums. [#5772](https://github.com/PyO3/pyo3/pull/5772)
- Fix `ambiguous_associated_items` compilation error when deriving `FromPyObject` or using `#[pyclass(from_py_object)]` macro on enums with `Error` variant. [#5784](https://github.com/PyO3/pyo3/pull/5784)
- Fix `__qualname__` for complex `#[pyclass]` enum variants to include the enum name. [#5796](https://github.com/PyO3/pyo3/pull/5796)
- Fix missing `std::sync::atomic::Ordering` import for targets without atomic64. [#5808](https://github.com/PyO3/pyo3/pull/5808)

## [0.28.0] - 2026-02-01

Expand Down Expand Up @@ -2498,8 +2507,9 @@ Yanked

- Initial release

[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.28.1...HEAD
[0.28.0]: https://github.com/pyo3/pyo3/compare/v0.28.0...v0.28.1
[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.28.2...HEAD
[0.28.2]: https://github.com/pyo3/pyo3/compare/v0.28.1...v0.28.2
[0.28.1]: https://github.com/pyo3/pyo3/compare/v0.28.0...v0.28.1
[0.28.0]: https://github.com/pyo3/pyo3/compare/v0.27.2...v0.28.0
[0.27.2]: https://github.com/pyo3/pyo3/compare/v0.27.1...v0.27.2
[0.27.1]: https://github.com/pyo3/pyo3/compare/v0.27.0...v0.27.1
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3"
version = "0.28.1"
version = "0.28.2"
description = "Bindings to Python interpreter"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
readme = "README.md"
Expand Down Expand Up @@ -29,10 +29,10 @@ libc = "0.2.62"
once_cell = "1.21"

# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
pyo3-ffi = { path = "pyo3-ffi", version = "=0.28.1" }
pyo3-ffi = { path = "pyo3-ffi", version = "=0.28.2" }

# support crate for macros feature
pyo3-macros = { path = "pyo3-macros", version = "=0.28.1", optional = true }
pyo3-macros = { path = "pyo3-macros", version = "=0.28.2", optional = true }

# support crate for multiple-pymethods feature
inventory = { version = "0.3.5", optional = true }
Expand Down Expand Up @@ -82,7 +82,7 @@ uuid = { version = "1.10.0", features = ["v4"] }
parking_lot = { version = "0.12.3", features = ["arc_lock"] }

[build-dependencies]
pyo3-build-config = { path = "pyo3-build-config", version = "=0.28.1", features = ["resolve-config"] }
pyo3-build-config = { path = "pyo3-build-config", version = "=0.28.2", features = ["resolve-config"] }

[features]
default = ["macros"]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ name = "string_sum"
crate-type = ["cdylib"]

[dependencies]
pyo3 = "0.28.1"
pyo3 = "0.28.2"
```

**`src/lib.rs`**
Expand Down Expand Up @@ -137,7 +137,7 @@ Start a new project with `cargo new` and add `pyo3` to the `Cargo.toml` like th

```toml
[dependencies.pyo3]
version = "0.28.1"
version = "0.28.2"
# Enabling this cargo feature will cause PyO3 to start a Python interpreter on first call to `Python::attach`
features = ["auto-initialize"]
```
Expand Down
2 changes: 1 addition & 1 deletion examples/decorator/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.28.1");
variable::set("PYO3_VERSION", "0.28.2");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/pyproject.toml", "pyproject.toml");
file::delete(".template");
2 changes: 1 addition & 1 deletion examples/maturin-starter/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.28.1");
variable::set("PYO3_VERSION", "0.28.2");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/pyproject.toml", "pyproject.toml");
file::delete(".template");
2 changes: 1 addition & 1 deletion examples/plugin/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.28.1");
variable::set("PYO3_VERSION", "0.28.2");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/plugin_api/Cargo.toml", "plugin_api/Cargo.toml");
file::delete(".template");
2 changes: 1 addition & 1 deletion examples/setuptools-rust-starter/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.28.1");
variable::set("PYO3_VERSION", "0.28.2");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/setup.cfg", "setup.cfg");
file::delete(".template");
2 changes: 1 addition & 1 deletion examples/word-count/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.28.1");
variable::set("PYO3_VERSION", "0.28.2");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/pyproject.toml", "pyproject.toml");
file::delete(".template");
1 change: 0 additions & 1 deletion newsfragments/5518-packaging.md

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/5808.fixed.md

This file was deleted.

2 changes: 1 addition & 1 deletion pyo3-build-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-build-config"
version = "0.28.1"
version = "0.28.2"
description = "Build configuration for the PyO3 ecosystem"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
Expand Down
4 changes: 2 additions & 2 deletions pyo3-ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-ffi"
version = "0.28.1"
version = "0.28.2"
description = "Python-API bindings for the PyO3 ecosystem"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
Expand Down Expand Up @@ -42,7 +42,7 @@ generate-import-lib = ["pyo3-build-config/generate-import-lib"]
paste = "1"

[build-dependencies]
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.28.1", features = ["resolve-config"] }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.28.2", features = ["resolve-config"] }

[lints]
workspace = true
Expand Down
4 changes: 2 additions & 2 deletions pyo3-ffi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ name = "string_sum"
crate-type = ["cdylib"]

[dependencies]
pyo3-ffi = "0.28.1"
pyo3-ffi = "0.28.2"

[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.28.1"
pyo3_build_config = "0.28.2"
```

If you need to use conditional compilation based on Python version or how
Expand Down
4 changes: 2 additions & 2 deletions pyo3-ffi/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ extern "C" {
pub fn PyObject_GetTypeData(obj: *mut PyObject, cls: *mut PyTypeObject) -> *mut c_void;

#[cfg(Py_3_12)]
#[cfg_attr(PyPy, link_name = "PyPyObject_GetTypeDataSize")]
pub fn PyObject_GetTypeDataSize(cls: *mut PyTypeObject) -> Py_ssize_t;
#[cfg_attr(PyPy, link_name = "PyPyType_GetTypeDataSize")]
pub fn PyType_GetTypeDataSize(cls: *mut PyTypeObject) -> Py_ssize_t;

#[cfg_attr(PyPy, link_name = "PyPyType_IsSubtype")]
pub fn PyType_IsSubtype(a: *mut PyTypeObject, b: *mut PyTypeObject) -> c_int;
Expand Down
2 changes: 1 addition & 1 deletion pyo3-introspection/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-introspection"
version = "0.28.1"
version = "0.28.2"
description = "Introspect dynamic libraries built with PyO3 to get metadata about the exported Python types"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
homepage = "https://github.com/pyo3/pyo3"
Expand Down
6 changes: 3 additions & 3 deletions pyo3-macros-backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-macros-backend"
version = "0.28.1"
version = "0.28.2"
description = "Code generation for PyO3 package"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
Expand All @@ -17,7 +17,7 @@ rust-version.workspace = true
[dependencies]
heck = "0.5"
proc-macro2 = { version = "1.0.60", default-features = false }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.28.1", features = ["resolve-config"] }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.28.2", features = ["resolve-config"] }
quote = { version = "1.0.37", default-features = false }

[dependencies.syn]
Expand All @@ -27,7 +27,7 @@ default-features = false
features = ["derive", "parsing", "printing", "clone-impls", "full", "extra-traits", "visit-mut"]

[build-dependencies]
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.28.1" }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.28.2" }

[lints]
workspace = true
Expand Down
45 changes: 38 additions & 7 deletions pyo3-macros-backend/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,12 +823,32 @@ struct PyClassEnumStructVariant<'a> {
options: EnumVariantPyO3Options,
}

impl PyClassEnumStructVariant<'_> {
fn python_name(&self) -> Cow<'_, syn::Ident> {
self.options
.name
.as_ref()
.map(|name_attr| Cow::Borrowed(&name_attr.value.0))
.unwrap_or_else(|| Cow::Owned(self.ident.unraw()))
}
}

struct PyClassEnumTupleVariant<'a> {
ident: &'a syn::Ident,
fields: Vec<PyClassEnumVariantUnnamedField<'a>>,
options: EnumVariantPyO3Options,
}

impl PyClassEnumTupleVariant<'_> {
fn python_name(&self) -> Cow<'_, syn::Ident> {
self.options
.name
.as_ref()
.map(|name_attr| Cow::Borrowed(&name_attr.value.0))
.unwrap_or_else(|| Cow::Owned(self.ident.unraw()))
}
}

struct PyClassEnumVariantNamedField<'a> {
ident: &'a syn::Ident,
ty: &'a syn::Type,
Expand Down Expand Up @@ -1288,7 +1308,7 @@ fn impl_complex_enum(
variant_cls_pytypeinfos.push(variant_cls_pytypeinfo);

let (variant_cls_impl, field_getters, mut slots) =
impl_complex_enum_variant_cls(cls, &variant, ctx)?;
impl_complex_enum_variant_cls(cls, &args, &variant, ctx)?;
variant_cls_impls.push(variant_cls_impl);

let variant_new = complex_enum_variant_new(cls, variant, ctx)?;
Expand Down Expand Up @@ -1341,15 +1361,16 @@ fn impl_complex_enum(

fn impl_complex_enum_variant_cls(
enum_name: &syn::Ident,
args: &PyClassArgs,
variant: &PyClassEnumVariant<'_>,
ctx: &Ctx,
) -> Result<(TokenStream, Vec<MethodAndMethodDef>, Vec<MethodAndSlotDef>)> {
match variant {
PyClassEnumVariant::Struct(struct_variant) => {
impl_complex_enum_struct_variant_cls(enum_name, struct_variant, ctx)
impl_complex_enum_struct_variant_cls(enum_name, args, struct_variant, ctx)
}
PyClassEnumVariant::Tuple(tuple_variant) => {
impl_complex_enum_tuple_variant_cls(enum_name, tuple_variant, ctx)
impl_complex_enum_tuple_variant_cls(enum_name, args, tuple_variant, ctx)
}
}
}
Expand Down Expand Up @@ -1406,6 +1427,7 @@ fn impl_complex_enum_variant_match_args(

fn impl_complex_enum_struct_variant_cls(
enum_name: &syn::Ident,
args: &PyClassArgs,
variant: &PyClassEnumStructVariant<'_>,
ctx: &Ctx,
) -> Result<(TokenStream, Vec<MethodAndMethodDef>, Vec<MethodAndSlotDef>)> {
Expand Down Expand Up @@ -1452,8 +1474,12 @@ fn impl_complex_enum_struct_variant_cls(
field_getter_impls.push(field_getter_impl);
}

let (qualname, qualname_impl) =
impl_complex_enum_variant_qualname(enum_name, variant_ident, &variant_cls_type, ctx)?;
let (qualname, qualname_impl) = impl_complex_enum_variant_qualname(
&get_class_python_name(enum_name, args),
&variant.python_name(),
&variant_cls_type,
ctx,
)?;

field_getters.push(qualname);

Expand Down Expand Up @@ -1624,6 +1650,7 @@ fn impl_complex_enum_tuple_variant_getitem(

fn impl_complex_enum_tuple_variant_cls(
enum_name: &syn::Ident,
args: &PyClassArgs,
variant: &PyClassEnumTupleVariant<'_>,
ctx: &Ctx,
) -> Result<(TokenStream, Vec<MethodAndMethodDef>, Vec<MethodAndSlotDef>)> {
Expand All @@ -1648,8 +1675,12 @@ fn impl_complex_enum_tuple_variant_cls(
&mut field_types,
)?;

let (qualname, qualname_impl) =
impl_complex_enum_variant_qualname(enum_name, variant_ident, &variant_cls_type, ctx)?;
let (qualname, qualname_impl) = impl_complex_enum_variant_qualname(
&get_class_python_name(enum_name, args),
&variant.python_name(),
&variant_cls_type,
ctx,
)?;

field_getters.push(qualname);

Expand Down
4 changes: 2 additions & 2 deletions pyo3-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-macros"
version = "0.28.1"
version = "0.28.2"
description = "Proc macros for PyO3 package"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
Expand All @@ -23,7 +23,7 @@ experimental-inspect = ["pyo3-macros-backend/experimental-inspect"]
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.28.1" }
pyo3-macros-backend = { path = "../pyo3-macros-backend", version = "=0.28.2" }

[lints]
workspace = true
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dynamic = ["version"]

[tool.towncrier]
filename = "CHANGELOG.md"
version = "0.28.1"
version = "0.28.2"
start_string = "<!-- towncrier release notes start -->\n"
template = ".towncrier.template.md"
title_format = "## [{version}] - {project_date}"
Expand Down
Loading