Merge pull request #2100 from mejrs/fix-1.58_v2
chore: Fix 1.58 release
This commit is contained in:
commit
2449df5732
|
@ -34,6 +34,7 @@ pub struct PyBuffer<T>(Pin<Box<ffi::Py_buffer>>, PhantomData<T>);
|
|||
|
||||
// PyBuffer is thread-safe: the shape of the buffer is immutable while a Py_buffer exists.
|
||||
// Accessing the buffer contents is protected using the GIL.
|
||||
#[allow(clippy::non_send_fields_in_send_ty)]
|
||||
unsafe impl<T> Send for PyBuffer<T> {}
|
||||
unsafe impl<T> Sync for PyBuffer<T> {}
|
||||
|
||||
|
|
|
@ -77,10 +77,9 @@ extern "C" {
|
|||
) -> *mut PyObject;
|
||||
#[cfg_attr(PyPy, link_name = "PyPyUnicode_FromObject")]
|
||||
pub fn PyUnicode_FromObject(obj: *mut PyObject) -> *mut PyObject;
|
||||
// #[cfg_attr(PyPy, link_name = "PyPyUnicode_FromFormatV")]
|
||||
// pub fn PyUnicode_FromFormatV(format: *const c_char, vargs: va_list) -> *mut PyObject;
|
||||
#[cfg_attr(PyPy, link_name = "PyPyUnicode_FromFormat")]
|
||||
#[cfg_attr(PyPy, link_name = "PyPyUnicode_FromFormatV")]
|
||||
//pub fn PyUnicode_FromFormatV(format: *const c_char,
|
||||
// vargs: va_list) -> *mut PyObject;
|
||||
pub fn PyUnicode_FromFormat(format: *const c_char, ...) -> *mut PyObject;
|
||||
#[cfg_attr(PyPy, link_name = "PyPyUnicode_InternInPlace")]
|
||||
pub fn PyUnicode_InternInPlace(arg1: *mut *mut PyObject);
|
||||
|
|
|
@ -23,22 +23,18 @@ fn _test_compile_errors() {
|
|||
t.compile_fail("tests/ui/invalid_pyclass_args.rs");
|
||||
t.compile_fail("tests/ui/invalid_pyclass_enum.rs");
|
||||
t.compile_fail("tests/ui/invalid_pyclass_item.rs");
|
||||
t.compile_fail("tests/ui/invalid_pyfunctions.rs");
|
||||
t.compile_fail("tests/ui/invalid_pymethods.rs");
|
||||
#[cfg(not(Py_LIMITED_API))]
|
||||
t.compile_fail("tests/ui/invalid_pymethods_buffer.rs");
|
||||
t.compile_fail("tests/ui/invalid_pymethod_names.rs");
|
||||
t.compile_fail("tests/ui/invalid_pymodule_args.rs");
|
||||
t.compile_fail("tests/ui/missing_clone.rs");
|
||||
t.compile_fail("tests/ui/reject_generics.rs");
|
||||
t.compile_fail("tests/ui/not_send.rs");
|
||||
t.compile_fail("tests/ui/invalid_pymethod_proto_args.rs");
|
||||
t.compile_fail("tests/ui/invalid_pymethod_proto_args_py.rs");
|
||||
|
||||
tests_rust_1_49(&t);
|
||||
tests_rust_1_55(&t);
|
||||
tests_rust_1_56(&t);
|
||||
tests_rust_1_57(&t);
|
||||
tests_rust_1_58(&t);
|
||||
|
||||
#[rustversion::since(1.49)]
|
||||
fn tests_rust_1_49(t: &trybuild::TestCases) {
|
||||
|
@ -47,22 +43,11 @@ fn _test_compile_errors() {
|
|||
#[rustversion::before(1.49)]
|
||||
fn tests_rust_1_49(_t: &trybuild::TestCases) {}
|
||||
|
||||
#[rustversion::since(1.55)]
|
||||
fn tests_rust_1_55(t: &trybuild::TestCases) {
|
||||
t.compile_fail("tests/ui/invalid_pymethod_receiver.rs");
|
||||
}
|
||||
|
||||
#[rustversion::before(1.55)]
|
||||
fn tests_rust_1_55(_t: &trybuild::TestCases) {}
|
||||
|
||||
#[rustversion::since(1.56)]
|
||||
fn tests_rust_1_56(t: &trybuild::TestCases) {
|
||||
t.compile_fail("tests/ui/invalid_closure.rs");
|
||||
t.compile_fail("tests/ui/invalid_result_conversion.rs");
|
||||
t.compile_fail("tests/ui/pyclass_send.rs");
|
||||
|
||||
#[cfg(Py_LIMITED_API)]
|
||||
t.compile_fail("tests/ui/abi3_nativetype_inheritance.rs");
|
||||
}
|
||||
|
||||
#[rustversion::before(1.56)]
|
||||
|
@ -78,4 +63,18 @@ fn _test_compile_errors() {
|
|||
|
||||
#[rustversion::before(1.57)]
|
||||
fn tests_rust_1_57(_t: &trybuild::TestCases) {}
|
||||
|
||||
#[rustversion::since(1.58)]
|
||||
fn tests_rust_1_58(t: &trybuild::TestCases) {
|
||||
t.compile_fail("tests/ui/invalid_pyfunctions.rs");
|
||||
t.compile_fail("tests/ui/invalid_pymethod_receiver.rs");
|
||||
t.compile_fail("tests/ui/invalid_pymethods.rs");
|
||||
t.compile_fail("tests/ui/missing_clone.rs");
|
||||
t.compile_fail("tests/ui/not_send.rs");
|
||||
#[cfg(Py_LIMITED_API)]
|
||||
t.compile_fail("tests/ui/abi3_nativetype_inheritance.rs");
|
||||
}
|
||||
|
||||
#[rustversion::before(1.58)]
|
||||
fn tests_rust_1_58(_t: &trybuild::TestCases) {}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
error[E0277]: the trait bound `PyDict: PyClass` is not satisfied
|
||||
--> tests/ui/abi3_nativetype_inheritance.rs:5:1
|
||||
|
|
||||
5 | #[pyclass(extends=PyDict)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PyClass` is not implemented for `PyDict`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `PyClassBaseType` for `PyDict`
|
||||
note: required by a bound in `PyClassBaseType`
|
||||
--> src/class/impl_.rs
|
||||
|
|
||||
| / pub trait PyClassBaseType: Sized {
|
||||
| | type LayoutAsBase: PyCellLayout<Self>;
|
||||
| | type BaseNativeType;
|
||||
| | type ThreadChecker: PyClassThreadChecker<Self>;
|
||||
| | type Initializer: PyObjectInit<Self>;
|
||||
| | }
|
||||
| |_^ required by this bound in `PyClassBaseType`
|
||||
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
--> tests/ui/abi3_nativetype_inheritance.rs:5:1
|
||||
|
|
||||
5 | #[pyclass(extends=PyDict)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PyClass` is not implemented for `PyDict`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `PyClassBaseType` for `PyDict`
|
||||
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `PyDict: PyClass` is not satisfied
|
||||
--> tests/ui/abi3_nativetype_inheritance.rs:5:1
|
||||
|
|
|
@ -12,7 +12,7 @@ error: Python functions cannot have `impl Trait` arguments
|
|||
|
||||
error: `async fn` is not yet supported for Python functions.
|
||||
|
||||
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
|
||||
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
|
||||
--> tests/ui/invalid_pyfunctions.rs:10:1
|
||||
|
|
||||
10 | async fn async_function() {}
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
error[E0277]: the trait bound `i32: From<&PyCell<MyClass>>` is not satisfied
|
||||
--> tests/ui/invalid_pymethod_receiver.rs:8:43
|
||||
|
|
||||
8 | fn method_with_invalid_self_type(slf: i32, py: Python, index: u32) {}
|
||||
| ^^^ the trait `From<&PyCell<MyClass>>` is not implemented for `i32`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<i32 as From<NonZeroI32>>
|
||||
<i32 as From<bool>>
|
||||
<i32 as From<i16>>
|
||||
<i32 as From<i8>>
|
||||
and 2 others
|
||||
= note: required because of the requirements on the impl of `Into<i32>` for `&PyCell<MyClass>`
|
||||
= note: required because of the requirements on the impl of `TryFrom<&PyCell<MyClass>>` for `i32`
|
||||
note: required by `std::convert::TryFrom::try_from`
|
||||
--> $RUST/core/src/convert/mod.rs
|
||||
|
|
||||
| fn try_from(value: T) -> Result<Self, Self::Error>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
--> tests/ui/invalid_pymethod_receiver.rs:8:43
|
||||
|
|
||||
8 | fn method_with_invalid_self_type(slf: i32, py: Python, index: u32) {}
|
||||
| ^^^ the trait `From<&PyCell<MyClass>>` is not implemented for `i32`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<i32 as From<NonZeroI32>>
|
||||
<i32 as From<bool>>
|
||||
<i32 as From<i16>>
|
||||
<i32 as From<i8>>
|
||||
and 2 others
|
||||
= note: required because of the requirements on the impl of `Into<i32>` for `&PyCell<MyClass>`
|
||||
= note: required because of the requirements on the impl of `TryFrom<&PyCell<MyClass>>` for `i32`
|
||||
|
|
|
@ -90,7 +90,7 @@ error: Python functions cannot have `impl Trait` arguments
|
|||
|
||||
error: `async fn` is not yet supported for Python functions.
|
||||
|
||||
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
|
||||
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
|
||||
--> tests/ui/invalid_pymethods.rs:107:5
|
||||
|
|
||||
107 | async fn async_method(&self) {}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
error[E0277]: the trait bound `TestClass: Clone` is not satisfied
|
||||
--> tests/ui/missing_clone.rs:15:32
|
||||
|
|
||||
15 | let t: TestClass = pyvalue.extract(py).unwrap();
|
||||
| ^^^^^^^ the trait `Clone` is not implemented for `TestClass`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `pyo3::FromPyObject<'_>` for `TestClass`
|
||||
--> tests/ui/missing_clone.rs:15:32
|
||||
|
|
||||
15 | let t: TestClass = pyvalue.extract(py).unwrap();
|
||||
| ^^^^^^^ the trait `Clone` is not implemented for `TestClass`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `pyo3::FromPyObject<'_>` for `TestClass`
|
||||
note: required by a bound in `pyo3::Py::<T>::extract`
|
||||
--> src/instance.rs
|
||||
|
|
||||
| D: FromPyObject<'p>,
|
||||
| ^^^^^^^^^^^^^^^^ required by this bound in `pyo3::Py::<T>::extract`
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safely
|
||||
--> tests/ui/not_send.rs:4:8
|
||||
|
|
||||
4 | py.allow_threads(|| { drop(py); });
|
||||
| ^^^^^^^^^^^^^ `*mut pyo3::Python<'static>` cannot be shared between threads safely
|
||||
|
|
||||
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
|
||||
= note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
|
||||
= note: required because it appears within the type `pyo3::impl_::not_send::NotSend`
|
||||
= note: required because it appears within the type `(&GILGuard, pyo3::impl_::not_send::NotSend)`
|
||||
= note: required because it appears within the type `PhantomData<(&GILGuard, pyo3::impl_::not_send::NotSend)>`
|
||||
= note: required because it appears within the type `pyo3::Python<'_>`
|
||||
= note: required because of the requirements on the impl of `Send` for `&pyo3::Python<'_>`
|
||||
= note: required because it appears within the type `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]`
|
||||
--> tests/ui/not_send.rs:4:8
|
||||
|
|
||||
4 | py.allow_threads(|| { drop(py); });
|
||||
| ^^^^^^^^^^^^^ `*mut pyo3::Python<'static>` cannot be shared between threads safely
|
||||
|
|
||||
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
|
||||
= note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
|
||||
= note: required because it appears within the type `pyo3::impl_::not_send::NotSend`
|
||||
= note: required because it appears within the type `(&GILGuard, pyo3::impl_::not_send::NotSend)`
|
||||
= note: required because it appears within the type `PhantomData<(&GILGuard, pyo3::impl_::not_send::NotSend)>`
|
||||
= note: required because it appears within the type `pyo3::Python<'_>`
|
||||
= note: required because of the requirements on the impl of `Send` for `&pyo3::Python<'_>`
|
||||
= note: required because it appears within the type `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]`
|
||||
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
|
||||
--> src/python.rs
|
||||
|
|
||||
| F: Send + FnOnce() -> T,
|
||||
| ^^^^ required by this bound in `pyo3::Python::<'py>::allow_threads`
|
||||
|
|
Loading…
Reference in New Issue