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

support 3.13t free-threaded python #471

Merged
merged 12 commits into from
Feb 19, 2025
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
"3.11",
"3.12",
"3.13",
"3.13t",
"pypy-3.9",
"pypy-3.10",
]
Expand Down Expand Up @@ -108,7 +109,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: Quansight-Labs/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.platform.python-architecture }}
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
- v0.24.0
- Support Python 3.13t "free-threaded" Python. ([#471](https://github.com/PyO3/rust-numpy/pull/471)

- v0.23.0
- Drop support for PyPy 3.7 and 3.8. ([#470](https://github.com/PyO3/rust-numpy/pull/470))
- Require `Element: Sync` as part of the free-threading support in PyO3 0.23 ([#469](https://github.com/PyO3/rust-numpy/pull/469))
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ num-complex = ">= 0.2, < 0.5"
num-integer = "0.1"
num-traits = "0.2"
ndarray = ">= 0.15, < 0.17"
pyo3 = { version = "0.23.3", default-features = false, features = ["macros"] }
pyo3 = { version = "0.23.4", default-features = false, features = ["macros"] }
rustc-hash = "2.0"

[dev-dependencies]
pyo3 = { version = "0.23.3", default-features = false, features = ["auto-initialize"] }
nalgebra = { version = ">=0.30, <0.34", default-features = false, features = ["std"] }

[build-dependencies]
pyo3-build-config = { version = "0.23.1", features = ["resolve-config"] }

[package.metadata.docs.rs]
all-features = true
8 changes: 6 additions & 2 deletions benches/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use test::{black_box, Bencher};
use std::ops::Range;

use numpy::{PyArray1, PyArray2, PyArray3};
use pyo3::{types::PyAnyMethods, Bound, Python};
use pyo3::{types::PyAnyMethods, Bound, IntoPyObjectExt, Python};

#[bench]
fn extract_success(bencher: &mut Bencher) {
Expand Down Expand Up @@ -115,7 +115,11 @@ fn from_slice_large(bencher: &mut Bencher) {
}

fn from_object_slice(bencher: &mut Bencher, size: usize) {
let vec = Python::with_gil(|py| (0..size).map(|val| val.to_object(py)).collect::<Vec<_>>());
let vec = Python::with_gil(|py| {
(0..size)
.map(|val| val.into_py_any(py).unwrap())
.collect::<Vec<_>>()
});

Python::with_gil(|py| {
bencher.iter(|| {
Expand Down
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
pyo3_build_config::use_pyo3_cfgs();
}
Loading
Loading