Skip to content

Commit 2449df5

Browse files
authored
Merge pull request #2100 from mejrs/fix-1.58_v2
chore: Fix 1.58 release
2 parents edf03c1 + 46c4581 commit 2449df5

9 files changed

+69
-75
lines changed

src/buffer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub struct PyBuffer<T>(Pin<Box<ffi::Py_buffer>>, PhantomData<T>);
3434

3535
// PyBuffer is thread-safe: the shape of the buffer is immutable while a Py_buffer exists.
3636
// Accessing the buffer contents is protected using the GIL.
37+
#[allow(clippy::non_send_fields_in_send_ty)]
3738
unsafe impl<T> Send for PyBuffer<T> {}
3839
unsafe impl<T> Sync for PyBuffer<T> {}
3940

src/ffi/unicodeobject.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@ extern "C" {
7777
) -> *mut PyObject;
7878
#[cfg_attr(PyPy, link_name = "PyPyUnicode_FromObject")]
7979
pub fn PyUnicode_FromObject(obj: *mut PyObject) -> *mut PyObject;
80+
// #[cfg_attr(PyPy, link_name = "PyPyUnicode_FromFormatV")]
81+
// pub fn PyUnicode_FromFormatV(format: *const c_char, vargs: va_list) -> *mut PyObject;
8082
#[cfg_attr(PyPy, link_name = "PyPyUnicode_FromFormat")]
81-
#[cfg_attr(PyPy, link_name = "PyPyUnicode_FromFormatV")]
82-
//pub fn PyUnicode_FromFormatV(format: *const c_char,
83-
// vargs: va_list) -> *mut PyObject;
8483
pub fn PyUnicode_FromFormat(format: *const c_char, ...) -> *mut PyObject;
8584
#[cfg_attr(PyPy, link_name = "PyPyUnicode_InternInPlace")]
8685
pub fn PyUnicode_InternInPlace(arg1: *mut *mut PyObject);

tests/test_compile_error.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,18 @@ fn _test_compile_errors() {
2323
t.compile_fail("tests/ui/invalid_pyclass_args.rs");
2424
t.compile_fail("tests/ui/invalid_pyclass_enum.rs");
2525
t.compile_fail("tests/ui/invalid_pyclass_item.rs");
26-
t.compile_fail("tests/ui/invalid_pyfunctions.rs");
27-
t.compile_fail("tests/ui/invalid_pymethods.rs");
2826
#[cfg(not(Py_LIMITED_API))]
2927
t.compile_fail("tests/ui/invalid_pymethods_buffer.rs");
3028
t.compile_fail("tests/ui/invalid_pymethod_names.rs");
3129
t.compile_fail("tests/ui/invalid_pymodule_args.rs");
32-
t.compile_fail("tests/ui/missing_clone.rs");
3330
t.compile_fail("tests/ui/reject_generics.rs");
34-
t.compile_fail("tests/ui/not_send.rs");
3531
t.compile_fail("tests/ui/invalid_pymethod_proto_args.rs");
3632
t.compile_fail("tests/ui/invalid_pymethod_proto_args_py.rs");
3733

3834
tests_rust_1_49(&t);
39-
tests_rust_1_55(&t);
4035
tests_rust_1_56(&t);
4136
tests_rust_1_57(&t);
37+
tests_rust_1_58(&t);
4238

4339
#[rustversion::since(1.49)]
4440
fn tests_rust_1_49(t: &trybuild::TestCases) {
@@ -47,22 +43,11 @@ fn _test_compile_errors() {
4743
#[rustversion::before(1.49)]
4844
fn tests_rust_1_49(_t: &trybuild::TestCases) {}
4945

50-
#[rustversion::since(1.55)]
51-
fn tests_rust_1_55(t: &trybuild::TestCases) {
52-
t.compile_fail("tests/ui/invalid_pymethod_receiver.rs");
53-
}
54-
55-
#[rustversion::before(1.55)]
56-
fn tests_rust_1_55(_t: &trybuild::TestCases) {}
57-
5846
#[rustversion::since(1.56)]
5947
fn tests_rust_1_56(t: &trybuild::TestCases) {
6048
t.compile_fail("tests/ui/invalid_closure.rs");
6149
t.compile_fail("tests/ui/invalid_result_conversion.rs");
6250
t.compile_fail("tests/ui/pyclass_send.rs");
63-
64-
#[cfg(Py_LIMITED_API)]
65-
t.compile_fail("tests/ui/abi3_nativetype_inheritance.rs");
6651
}
6752

6853
#[rustversion::before(1.56)]
@@ -78,4 +63,18 @@ fn _test_compile_errors() {
7863

7964
#[rustversion::before(1.57)]
8065
fn tests_rust_1_57(_t: &trybuild::TestCases) {}
66+
67+
#[rustversion::since(1.58)]
68+
fn tests_rust_1_58(t: &trybuild::TestCases) {
69+
t.compile_fail("tests/ui/invalid_pyfunctions.rs");
70+
t.compile_fail("tests/ui/invalid_pymethod_receiver.rs");
71+
t.compile_fail("tests/ui/invalid_pymethods.rs");
72+
t.compile_fail("tests/ui/missing_clone.rs");
73+
t.compile_fail("tests/ui/not_send.rs");
74+
#[cfg(Py_LIMITED_API)]
75+
t.compile_fail("tests/ui/abi3_nativetype_inheritance.rs");
76+
}
77+
78+
#[rustversion::before(1.58)]
79+
fn tests_rust_1_58(_t: &trybuild::TestCases) {}
8180
}

tests/ui/abi3_nativetype_inheritance.stderr

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
error[E0277]: the trait bound `PyDict: PyClass` is not satisfied
2-
--> tests/ui/abi3_nativetype_inheritance.rs:5:1
3-
|
4-
5 | #[pyclass(extends=PyDict)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PyClass` is not implemented for `PyDict`
6-
|
7-
= note: required because of the requirements on the impl of `PyClassBaseType` for `PyDict`
8-
note: required by a bound in `PyClassBaseType`
9-
--> src/class/impl_.rs
10-
|
11-
| / pub trait PyClassBaseType: Sized {
12-
| | type LayoutAsBase: PyCellLayout<Self>;
13-
| | type BaseNativeType;
14-
| | type ThreadChecker: PyClassThreadChecker<Self>;
15-
| | type Initializer: PyObjectInit<Self>;
16-
| | }
17-
| |_^ required by this bound in `PyClassBaseType`
18-
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
2+
--> tests/ui/abi3_nativetype_inheritance.rs:5:1
3+
|
4+
5 | #[pyclass(extends=PyDict)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PyClass` is not implemented for `PyDict`
6+
|
7+
= note: required because of the requirements on the impl of `PyClassBaseType` for `PyDict`
8+
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
199

2010
error[E0277]: the trait bound `PyDict: PyClass` is not satisfied
2111
--> tests/ui/abi3_nativetype_inheritance.rs:5:1

tests/ui/invalid_pyfunctions.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ error: Python functions cannot have `impl Trait` arguments
1212

1313
error: `async fn` is not yet supported for Python functions.
1414

15-
Additional crates such as `pyo3-asyncio` can be used to integrate async Rust and Python. For more information, see https://github.com/PyO3/pyo3/issues/1632
15+
Additional crates such as `pyo3-asyncio` can be used to integrate async Rust and Python. For more information, see https://github.com/PyO3/pyo3/issues/1632
1616
--> tests/ui/invalid_pyfunctions.rs:10:1
1717
|
1818
10 | async fn async_function() {}
Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
error[E0277]: the trait bound `i32: From<&PyCell<MyClass>>` is not satisfied
2-
--> tests/ui/invalid_pymethod_receiver.rs:8:43
3-
|
4-
8 | fn method_with_invalid_self_type(slf: i32, py: Python, index: u32) {}
5-
| ^^^ the trait `From<&PyCell<MyClass>>` is not implemented for `i32`
6-
|
7-
= help: the following implementations were found:
8-
<i32 as From<NonZeroI32>>
9-
<i32 as From<bool>>
10-
<i32 as From<i16>>
11-
<i32 as From<i8>>
12-
and 2 others
13-
= note: required because of the requirements on the impl of `Into<i32>` for `&PyCell<MyClass>`
14-
= note: required because of the requirements on the impl of `TryFrom<&PyCell<MyClass>>` for `i32`
15-
note: required by `std::convert::TryFrom::try_from`
16-
--> $RUST/core/src/convert/mod.rs
17-
|
18-
| fn try_from(value: T) -> Result<Self, Self::Error>;
19-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2+
--> tests/ui/invalid_pymethod_receiver.rs:8:43
3+
|
4+
8 | fn method_with_invalid_self_type(slf: i32, py: Python, index: u32) {}
5+
| ^^^ the trait `From<&PyCell<MyClass>>` is not implemented for `i32`
6+
|
7+
= help: the following implementations were found:
8+
<i32 as From<NonZeroI32>>
9+
<i32 as From<bool>>
10+
<i32 as From<i16>>
11+
<i32 as From<i8>>
12+
and 2 others
13+
= note: required because of the requirements on the impl of `Into<i32>` for `&PyCell<MyClass>`
14+
= note: required because of the requirements on the impl of `TryFrom<&PyCell<MyClass>>` for `i32`

tests/ui/invalid_pymethods.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ error: Python functions cannot have `impl Trait` arguments
9090

9191
error: `async fn` is not yet supported for Python functions.
9292

93-
Additional crates such as `pyo3-asyncio` can be used to integrate async Rust and Python. For more information, see https://github.com/PyO3/pyo3/issues/1632
93+
Additional crates such as `pyo3-asyncio` can be used to integrate async Rust and Python. For more information, see https://github.com/PyO3/pyo3/issues/1632
9494
--> tests/ui/invalid_pymethods.rs:107:5
9595
|
9696
107 | async fn async_method(&self) {}

tests/ui/missing_clone.stderr

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
error[E0277]: the trait bound `TestClass: Clone` is not satisfied
2-
--> tests/ui/missing_clone.rs:15:32
3-
|
4-
15 | let t: TestClass = pyvalue.extract(py).unwrap();
5-
| ^^^^^^^ the trait `Clone` is not implemented for `TestClass`
6-
|
7-
= note: required because of the requirements on the impl of `pyo3::FromPyObject<'_>` for `TestClass`
2+
--> tests/ui/missing_clone.rs:15:32
3+
|
4+
15 | let t: TestClass = pyvalue.extract(py).unwrap();
5+
| ^^^^^^^ the trait `Clone` is not implemented for `TestClass`
6+
|
7+
= note: required because of the requirements on the impl of `pyo3::FromPyObject<'_>` for `TestClass`
8+
note: required by a bound in `pyo3::Py::<T>::extract`
9+
--> src/instance.rs
10+
|
11+
| D: FromPyObject<'p>,
12+
| ^^^^^^^^^^^^^^^^ required by this bound in `pyo3::Py::<T>::extract`

tests/ui/not_send.stderr

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safely
2-
--> tests/ui/not_send.rs:4:8
3-
|
4-
4 | py.allow_threads(|| { drop(py); });
5-
| ^^^^^^^^^^^^^ `*mut pyo3::Python<'static>` cannot be shared between threads safely
6-
|
7-
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
8-
= note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
9-
= note: required because it appears within the type `pyo3::impl_::not_send::NotSend`
10-
= note: required because it appears within the type `(&GILGuard, pyo3::impl_::not_send::NotSend)`
11-
= note: required because it appears within the type `PhantomData<(&GILGuard, pyo3::impl_::not_send::NotSend)>`
12-
= note: required because it appears within the type `pyo3::Python<'_>`
13-
= note: required because of the requirements on the impl of `Send` for `&pyo3::Python<'_>`
14-
= note: required because it appears within the type `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]`
2+
--> tests/ui/not_send.rs:4:8
3+
|
4+
4 | py.allow_threads(|| { drop(py); });
5+
| ^^^^^^^^^^^^^ `*mut pyo3::Python<'static>` cannot be shared between threads safely
6+
|
7+
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
8+
= note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
9+
= note: required because it appears within the type `pyo3::impl_::not_send::NotSend`
10+
= note: required because it appears within the type `(&GILGuard, pyo3::impl_::not_send::NotSend)`
11+
= note: required because it appears within the type `PhantomData<(&GILGuard, pyo3::impl_::not_send::NotSend)>`
12+
= note: required because it appears within the type `pyo3::Python<'_>`
13+
= note: required because of the requirements on the impl of `Send` for `&pyo3::Python<'_>`
14+
= note: required because it appears within the type `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]`
15+
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
16+
--> src/python.rs
17+
|
18+
| F: Send + FnOnce() -> T,
19+
| ^^^^ required by this bound in `pyo3::Python::<'py>::allow_threads`

0 commit comments

Comments
 (0)