Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.22.3 #4518

Merged
merged 32 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
be10c5e
clean up hygiene tests (#4328)
davidhewitt Jul 9, 2024
cd70cec
Improve error messages for #[pyfunction] defined inside #[pymethods] …
csernazs Jul 24, 2024
6710dcd
Update dict.get_item binding to use PyDict_GetItemRef (#4355)
ngoldbaum Aug 1, 2024
37e9122
fix: adding tests for pyclass hygiene cases (#4359)
Zyell Jul 17, 2024
9e36baa
fix incorrect spans on `ret` and `py` local varianbles in emitted cod…
Icxolu Jul 27, 2024
ebd4747
Add missing #[allow(unsafe_code)] attributes (#4396)
LilyFoote Aug 2, 2024
d103c76
fix returning tuples from async fns (#4407)
birkenfeld Aug 1, 2024
5e6e432
Add PyList_GetItemRef and use it in list.get_item (#4410)
ngoldbaum Aug 9, 2024
4275773
ffi: update `modsupport.rs` for Python 3.13 (#4420)
davidhewitt Aug 9, 2024
2fc6e62
Fix a soundness bug with `PyClassInitializer` (#4454)
ChayimFriedman2 Aug 21, 2024
36ca4a1
avoid creating `PyRef` inside `__traverse__` handler (#4479)
davidhewitt Aug 28, 2024
2b0a36e
ffi: define compat for `Py_NewRef` and `Py_XNewRef` (#4445)
davidhewitt Aug 17, 2024
b0c4256
ffi: add compat functions for no-argument calls (#4461)
davidhewitt Aug 21, 2024
1ad96b3
Add Python-ref cloning `GILOnceCell::<Py<T>>::clone_ref` (#4511)
jakelishman Sep 3, 2024
196c5fe
Use vectorcall (where possible) when calling Python functions (#4456)
ChayimFriedman2 Aug 25, 2024
5d4a155
mention type name in "no constructor defined" message (#4481)
birkenfeld Aug 24, 2024
09d6dbe
fixup CI warnings
davidhewitt Sep 3, 2024
5abc496
ci: fix nightly build
davidhewitt Sep 3, 2024
01bd06c
ci: ui test updates
davidhewitt Sep 13, 2024
1c82750
ci: swap .python-version file for explicit versions in actions yml (#…
davidhewitt Aug 21, 2024
3f4b125
ci: install cargo-codspeed binary (#4430)
davidhewitt Aug 10, 2024
bed8161
ci: fix benchmarks build
davidhewitt Sep 13, 2024
4057c6e
fix ui tests (#4397)
Icxolu Jul 30, 2024
9acf868
ci: fix diagnostic case with abi3
davidhewitt Sep 13, 2024
d183248
fix nightly ci (#4385)
Icxolu Jul 27, 2024
a8e9c73
fix beta/nightly ci (#4549)
Icxolu Sep 13, 2024
076555f
type_object: fix new clippy complaint about length of doc comment (#4…
birkenfeld Sep 4, 2024
b9f65d5
ci: fix nightly warning about unreachable pattern (#4437)
davidhewitt Aug 12, 2024
01a22ed
ci: updates for Rust 1.81 (#4533)
Icxolu Sep 5, 2024
f0b6bfd
ci: fixup abi3 ui test output
davidhewitt Sep 13, 2024
8978b22
revert removal of `_Py_XNewRef` and `_Py_NewRef` in 0.22 line
davidhewitt Sep 13, 2024
d8510d1
release: 0.22.3
davidhewitt Sep 13, 2024
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
7 changes: 5 additions & 2 deletions .github/workflows/benches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: dtolnay/rust-toolchain@stable
with:
components: rust-src
Expand All @@ -30,8 +32,9 @@ jobs:
pyo3-benches
continue-on-error: true

- name: Install cargo-codspeed
run: cargo install cargo-codspeed
- uses: taiki-e/install-action@v2
with:
tool: cargo-codspeed

- name: Install nox
run: pip install nox
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: python -m pip install --upgrade pip && pip install nox
- run: nox -s check-changelog
24 changes: 22 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: python -m pip install --upgrade pip && pip install nox
- uses: dtolnay/rust-toolchain@stable
with:
Expand All @@ -38,6 +40,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: resolve MSRV
id: resolve-msrv
run:
Expand All @@ -50,6 +54,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: obi1kenobi/cargo-semver-checks-action@v2

check-msrv:
Expand All @@ -60,11 +66,10 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.resolve.outputs.MSRV }}
targets: x86_64-unknown-linux-gnu
components: rust-src
- uses: actions/setup-python@v5
with:
architecture: "x64"
python-version: '3.12'
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name != 'merge_group' }}
Expand Down Expand Up @@ -143,6 +148,7 @@ jobs:
components: clippy,rust-src
- uses: actions/setup-python@v5
with:
python-version: '3.12'
architecture: ${{ matrix.platform.python-architecture }}
- uses: Swatinem/rust-cache@v2
with:
Expand Down Expand Up @@ -324,6 +330,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
# FIXME valgrind detects an issue with Python 3.12.5, needs investigation
# whether it's a PyO3 issue or upstream CPython.
python-version: '3.12.4'
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name != 'merge_group' }}
Expand All @@ -343,6 +353,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name != 'merge_group' }}
Expand All @@ -363,6 +375,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name != 'merge_group' }}
Expand All @@ -387,6 +401,8 @@ jobs:
if: steps.should-skip.outputs.skip != 'true'
- uses: actions/setup-python@v5
if: steps.should-skip.outputs.skip != 'true'
with:
python-version: '3.12'
- uses: Swatinem/rust-cache@v2
if: steps.should-skip.outputs.skip != 'true'
with:
Expand Down Expand Up @@ -517,6 +533,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name != 'merge_group' }}
Expand Down Expand Up @@ -584,6 +602,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: Swatinem/rust-cache@v2
with:
workspaces:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: dtolnay/rust-toolchain@nightly

- name: Setup mdBook
Expand Down
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,40 @@ To see unreleased changes, please see the [CHANGELOG on the main branch guide](h

<!-- towncrier release notes start -->

## [0.22.3] - 2024-09-15

### Added

- Add `pyo3::ffi::compat` namespace with compatibility shims for C API functions added in recent versions of Python.
- Add FFI definition `PyDict_GetItemRef` on Python 3.13 and newer, and `compat::PyDict_GetItemRef` for all versions. [#4355](https://github.com/PyO3/pyo3/pull/4355)
- Add FFI definition `PyList_GetItemRef` on Python 3.13 and newer, and `pyo3_ffi::compat::PyList_GetItemRef` for all versions. [#4410](https://github.com/PyO3/pyo3/pull/4410)
- Add FFI definitions `compat::Py_NewRef` and `compat::Py_XNewRef`. [#4445](https://github.com/PyO3/pyo3/pull/4445)
- Add FFI definitions `compat::PyObject_CallNoArgs` and `compat::PyObject_CallMethodNoArgs`. [#4461](https://github.com/PyO3/pyo3/pull/4461)
- Add `GilOnceCell<Py<T>>::clone_ref`. [#4511](https://github.com/PyO3/pyo3/pull/4511)

### Changed

- Improve error messages for `#[pyfunction]` defined inside `#[pymethods]`. [#4349](https://github.com/PyO3/pyo3/pull/4349)
- Improve performance of calls to Python by using the vectorcall calling convention where possible. [#4456](https://github.com/PyO3/pyo3/pull/4456)
- Mention the type name in the exception message when trying to instantiate a class with no constructor defined. [#4481](https://github.com/PyO3/pyo3/pull/4481)

### Removed

- Remove private FFI definition `_Py_PackageContext`. [#4420](https://github.com/PyO3/pyo3/pull/4420)

### Fixed

- Fix compile failure in declarative `#[pymodule]` under presence of `#![no_implicit_prelude]`. [#4328](https://github.com/PyO3/pyo3/pull/4328)
- Fix use of borrowed reference in `PyDict::get_item` (unsafe in free-threaded Python). [#4355](https://github.com/PyO3/pyo3/pull/4355)
- Fix `#[pyclass(eq)]` macro hygiene issues for structs and enums. [#4359](https://github.com/PyO3/pyo3/pull/4359)
- Fix hygiene/span issues of `'#[pyfunction]` and `#[pymethods]` generated code which affected expansion in `macro_rules` context. [#4382](https://github.com/PyO3/pyo3/pull/4382)
- Fix `unsafe_code` lint error in `#[pyclass]` generated code. [#4396](https://github.com/PyO3/pyo3/pull/4396)
- Fix async functions returning a tuple only returning the first element to Python. [#4407](https://github.com/PyO3/pyo3/pull/4407)
- Fix use of borrowed reference in `PyList::get_item` (unsafe in free-threaded Python). [#4410](https://github.com/PyO3/pyo3/pull/4410)
- Correct FFI definition `PyArg_ParseTupleAndKeywords` to take `*const *const c_char` instead of `*mut *mut c_char` on Python 3.13 and up. [#4420](https://github.com/PyO3/pyo3/pull/4420)
- Fix a soundness bug with `PyClassInitializer`: panic if adding subclass to existing instance via `PyClassInitializer::from(Py<BaseClass>).add_subclass(SubClass)`. [#4454](https://github.com/PyO3/pyo3/pull/4454)
- Fix illegal reference counting op inside implementation of `__traverse__` handlers. [#4479](https://github.com/PyO3/pyo3/pull/4479)

## [0.22.2] - 2024-07-17

### Packaging
Expand Down
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3"
version = "0.22.2"
version = "0.22.3"
description = "Bindings to Python interpreter"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
readme = "README.md"
Expand All @@ -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.22.2" }
pyo3-ffi = { path = "pyo3-ffi", version = "=0.22.3" }

# support crates for macros feature
pyo3-macros = { path = "pyo3-macros", version = "=0.22.2", optional = true }
pyo3-macros = { path = "pyo3-macros", version = "=0.22.3", optional = true }
indoc = { version = "2.0.1", optional = true }
unindent = { version = "0.2.1", optional = true }

Expand Down Expand Up @@ -61,9 +61,10 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.61"
rayon = "1.6.1"
futures = "0.3.28"
static_assertions = "1.1.0"

[build-dependencies]
pyo3-build-config = { path = "pyo3-build-config", version = "=0.22.2", features = ["resolve-config"] }
pyo3-build-config = { path = "pyo3-build-config", version = "=0.22.3", 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 @@ -68,7 +68,7 @@ name = "string_sum"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.22.2", features = ["extension-module"] }
pyo3 = { version = "0.22.3", features = ["extension-module"] }
```

**`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.22.2"
version = "0.22.3"
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.22.2");
variable::set("PYO3_VERSION", "0.22.3");
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.22.2");
variable::set("PYO3_VERSION", "0.22.3");
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.22.2");
variable::set("PYO3_VERSION", "0.22.3");
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.22.2");
variable::set("PYO3_VERSION", "0.22.3");
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.22.2");
variable::set("PYO3_VERSION", "0.22.3");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/pyproject.toml", "pyproject.toml");
file::delete(".template");
2 changes: 2 additions & 0 deletions guide/src/class.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ For simple cases where a member variable is just read and written with no side e

```rust
# use pyo3::prelude::*;
# #[allow(dead_code)]
#[pyclass]
struct MyClass {
#[pyo3(get, set)]
Expand Down Expand Up @@ -1360,6 +1361,7 @@ The `#[pyclass]` macro expands to roughly the code seen below. The `PyClassImplC
# #[cfg(not(feature = "multiple-pymethods"))] {
# use pyo3::prelude::*;
// Note: the implementation differs slightly with the `multiple-pymethods` feature enabled.
# #[allow(dead_code)]
struct MyClass {
# #[allow(dead_code)]
num: i32,
Expand Down
8 changes: 8 additions & 0 deletions guide/src/class/object.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ the subclass name. This is typically done in Python code by accessing
# use pyo3::prelude::*;
# use pyo3::types::PyString;
#
# #[allow(dead_code)]
# #[pyclass]
# struct Number(i32);
#
Expand Down Expand Up @@ -110,6 +111,7 @@ use std::hash::{Hash, Hasher};

# use pyo3::prelude::*;
#
# #[allow(dead_code)]
# #[pyclass]
# struct Number(i32);
#
Expand All @@ -130,6 +132,7 @@ method it should not define a `__hash__()` operation either"
```rust
# use pyo3::prelude::*;
#
# #[allow(dead_code)]
#[pyclass(frozen, eq, hash)]
#[derive(PartialEq, Hash)]
struct Number(i32);
Expand Down Expand Up @@ -173,6 +176,7 @@ use pyo3::class::basic::CompareOp;

# use pyo3::prelude::*;
#
# #[allow(dead_code)]
# #[pyclass]
# struct Number(i32);
#
Expand All @@ -199,6 +203,7 @@ use pyo3::class::basic::CompareOp;

# use pyo3::prelude::*;
#
# #[allow(dead_code)]
# #[pyclass]
# struct Number(i32);
#
Expand Down Expand Up @@ -245,6 +250,7 @@ To implement `__eq__` using the Rust [`PartialEq`] trait implementation, the `eq
```rust
# use pyo3::prelude::*;
#
# #[allow(dead_code)]
#[pyclass(eq)]
#[derive(PartialEq)]
struct Number(i32);
Expand All @@ -255,6 +261,7 @@ To implement `__lt__`, `__le__`, `__gt__`, & `__ge__` using the Rust `PartialOrd
```rust
# use pyo3::prelude::*;
#
# #[allow(dead_code)]
#[pyclass(eq, ord)]
#[derive(PartialEq, PartialOrd)]
struct Number(i32);
Expand All @@ -267,6 +274,7 @@ We'll consider `Number` to be `True` if it is nonzero:
```rust
# use pyo3::prelude::*;
#
# #[allow(dead_code)]
# #[pyclass]
# struct Number(i32);
#
Expand Down
1 change: 1 addition & 0 deletions guide/src/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ done with the `crate` attribute:
# use pyo3::prelude::*;
# pub extern crate pyo3;
# mod reexported { pub use ::pyo3; }
# #[allow(dead_code)]
#[pyclass]
#[pyo3(crate = "reexported::pyo3")]
struct MyClass;
Expand Down
4 changes: 2 additions & 2 deletions guide/src/python-from-rust/calling-existing-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn main() -> PyResult<()> {
## Want to run just an expression? Then use `eval_bound`.

[`Python::eval_bound`]({{#PYO3_DOCS_URL}}/pyo3/marker/struct.Python.html#method.eval_bound) is
a method to execute a [Python expression](https://docs.python.org/3.7/reference/expressions.html)
a method to execute a [Python expression](https://docs.python.org/3/reference/expressions.html)
and return the evaluated value as a `Bound<'py, PyAny>` object.

```rust
Expand All @@ -50,7 +50,7 @@ Python::with_gil(|py| {
## Want to run statements? Then use `run_bound`.

[`Python::run_bound`] is a method to execute one or more
[Python statements](https://docs.python.org/3.7/reference/simple_stmts.html).
[Python statements](https://docs.python.org/3/reference/simple_stmts.html).
This method returns nothing (like any Python statement), but you can get
access to manipulated objects via the `locals` dict.

Expand Down
Loading
Loading