Skip to content

Commit 69fc9cb

Browse files
authored
update PyO3 to 0.26 (#219)
1 parent d60dc16 commit 69fc9cb

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ inherits = "release"
2525
debug = true
2626

2727
[workspace.dependencies]
28-
pyo3 = { version = "0.25" }
29-
pyo3-build-config = { version = "0.25" }
28+
pyo3 = { version = "0.26" }
29+
pyo3-build-config = { version = "0.26" }

crates/jiter-python/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jiter = { path = "../jiter", features = ["python", "num-bigint"] }
1616

1717
[features]
1818
# make extensions visible to cargo vendor
19-
extension-module = ["pyo3/extension-module", "pyo3/generate-import-lib"]
19+
extension-module = ["pyo3/generate-import-lib"]
2020

2121
[lib]
2222
name = "jiter_python"

crates/jiter-python/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["maturin>=1,<2"]
2+
requires = ["maturin>=1.9.4,<2"]
33
build-backend = "maturin"
44

55
[project]
@@ -40,7 +40,7 @@ dynamic = ["version"]
4040
[tool.maturin]
4141
module-name = "jiter"
4242
bindings = "pyo3"
43-
features = ["pyo3/extension-module", "pyo3/generate-import-lib"]
43+
features = ["pyo3/generate-import-lib"]
4444

4545
[tool.ruff]
4646
target-version = "py39"

crates/jiter/benches/python.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use pyo3::Python;
99
use jiter::{cache_clear, PythonParse, StringCacheMode};
1010

1111
fn python_parse_numeric(c: &mut Criterion) {
12-
Python::with_gil(|py| {
12+
Python::attach(|py| {
1313
cache_clear();
1414
c.bench_function("python_parse_numeric", |bench| {
1515
bench.iter(|| {
@@ -25,7 +25,7 @@ fn python_parse_numeric(c: &mut Criterion) {
2525
}
2626

2727
fn python_parse_other(c: &mut Criterion) {
28-
Python::with_gil(|py| {
28+
Python::attach(|py| {
2929
cache_clear();
3030
c.bench_function("python_parse_other", |bench| {
3131
bench.iter(|| {
@@ -55,7 +55,7 @@ fn python_parse_file(path: &str, c: &mut Criterion, cache_mode: StringCacheMode)
5555
"python_parse_".to_owned() + file_stem + cache_mode
5656
};
5757

58-
Python::with_gil(|py| {
58+
Python::attach(|py| {
5959
cache_clear();
6060

6161
c.bench_function(&title, |bench| {

crates/jiter/src/py_lossless_float.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use pyo3::exceptions::{PyTypeError, PyValueError};
22
use pyo3::prelude::*;
3-
use pyo3::sync::GILOnceCell;
3+
use pyo3::sync::PyOnceLock;
44
use pyo3::types::PyType;
55

66
use crate::Jiter;
@@ -87,7 +87,7 @@ impl LosslessFloat {
8787
}
8888
}
8989

90-
static DECIMAL_TYPE: GILOnceCell<Py<PyType>> = GILOnceCell::new();
90+
static DECIMAL_TYPE: PyOnceLock<Py<PyType>> = PyOnceLock::new();
9191

9292
pub fn get_decimal_type(py: Python<'_>) -> PyResult<&Bound<'_, PyType>> {
9393
DECIMAL_TYPE.import(py, "decimal", "Decimal")

crates/jiter/tests/python.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn test_to_py_object_numeric() {
1111
false,
1212
)
1313
.unwrap();
14-
Python::with_gil(|py| {
14+
Python::attach(|py| {
1515
let python_value = value.into_pyobject(py).unwrap();
1616
let string = python_value.to_string();
1717
assert_eq!(
@@ -28,7 +28,7 @@ fn test_to_py_object_other() {
2828
true,
2929
)
3030
.unwrap();
31-
Python::with_gil(|py| {
31+
Python::attach(|py| {
3232
let python_value = value.into_pyobject(py).unwrap();
3333
let string = python_value.to_string();
3434
assert_eq!(string, "['string', '£', True, False, None, nan, inf, -inf]");
@@ -37,7 +37,7 @@ fn test_to_py_object_other() {
3737

3838
#[test]
3939
fn test_cache_into() {
40-
Python::with_gil(|py| {
40+
Python::attach(|py| {
4141
let c: StringCacheMode = true.into_pyobject(py).unwrap().extract().unwrap();
4242
assert!(matches!(c, StringCacheMode::All));
4343

@@ -73,15 +73,15 @@ fn test_cache_into() {
7373
#[test]
7474
fn test_pystring_ascii_new() {
7575
let json = "100abc";
76-
Python::with_gil(|py| {
76+
Python::attach(|py| {
7777
let s = unsafe { pystring_ascii_new(py, json) };
7878
assert_eq!(s.to_string(), "100abc");
7979
});
8080
}
8181

8282
#[test]
8383
fn test_python_parse_default() {
84-
Python::with_gil(|py| {
84+
Python::attach(|py| {
8585
let v = PythonParse::default().python_parse(py, b"[123]").unwrap();
8686
assert_eq!(v.to_string(), "[123]");
8787
});

0 commit comments

Comments
 (0)