Skip to content

Commit

Permalink
ci: updates for Rust 1.84 (#4846)
Browse files Browse the repository at this point in the history
* Fix failing ruff fmt test

* Add newsfragments

* remove changelog

* use wasm32-wasip1 in CI

* update ui tests

* use `wasm32-wasip1` in noxfile

* update one more ui test

* fix clippy beta

* bump `EMSCRIPTEN_VERSION`

* emscripten link `sqlite3`

* emscipten update node

---------

Co-authored-by: Nathan Goldbaum <[email protected]>
Co-authored-by: Icxolu <[email protected]>
  • Loading branch information
3 people authored Jan 9, 2025
1 parent c0f08c2 commit 1840bc5
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
{
os: "ubuntu-latest",
python-architecture: "x64",
rust-target: "wasm32-wasi",
rust-target: "wasm32-wasip1",
},
{
os: "windows-latest",
Expand Down Expand Up @@ -489,7 +489,7 @@ jobs:
components: rust-src
- uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
- run: python -m pip install --upgrade pip && pip install nox
- uses: actions/cache@v4
id: cache
Expand Down
2 changes: 1 addition & 1 deletion emscripten/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CURDIR=$(abspath .)
BUILDROOT ?= $(CURDIR)/builddir
PYMAJORMINORMICRO ?= 3.11.0

EMSCRIPTEN_VERSION=3.1.13
EMSCRIPTEN_VERSION=3.1.68

export EMSDKDIR = $(BUILDROOT)/emsdk

Expand Down
7 changes: 4 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def test_emscripten(session: nox.Session):
f"-C link-arg=-lpython{info.pymajorminor}",
"-C link-arg=-lexpat",
"-C link-arg=-lmpdec",
"-C link-arg=-lsqlite3",
"-C link-arg=-lz",
"-C link-arg=-lbz2",
"-C link-arg=-sALLOW_MEMORY_GROWTH=1",
Expand All @@ -351,7 +352,7 @@ def test_emscripten(session: nox.Session):
session,
"bash",
"-c",
f"source {info.builddir/'emsdk/emsdk_env.sh'} && cargo test",
f"source {info.builddir / 'emsdk/emsdk_env.sh'} && cargo test",
)


Expand Down Expand Up @@ -797,7 +798,7 @@ def _get_rust_default_target() -> str:
def _get_feature_sets() -> Tuple[Tuple[str, ...], ...]:
"""Returns feature sets to use for clippy job"""
cargo_target = os.getenv("CARGO_BUILD_TARGET", "")
if "wasm32-wasi" not in cargo_target:
if "wasm32-wasip1" not in cargo_target:
# multiple-pymethods not supported on wasm
return (
("--no-default-features",),
Expand Down Expand Up @@ -951,7 +952,7 @@ def set(
f"""\
implementation={implementation}
version={version}
build_flags={','.join(build_flags)}
build_flags={",".join(build_flags)}
suppress_build_script_link_lines=true
"""
)
Expand Down
2 changes: 1 addition & 1 deletion pyo3-build-config/src/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,7 @@ fn unescape(escaped: &str) -> Vec<u8> {
}
}

bytes.push(unhex(chunk[0]) << 4 | unhex(chunk[1]));
bytes.push((unhex(chunk[0]) << 4) | unhex(chunk[1]));
}

bytes
Expand Down
2 changes: 1 addition & 1 deletion pyo3-ffi/src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub struct PyDateTime_DateTime {
pub unsafe fn PyDateTime_GET_YEAR(o: *mut PyObject) -> c_int {
// This should work for Date or DateTime
let data = (*(o as *mut PyDateTime_Date)).data;
c_int::from(data[0]) << 8 | c_int::from(data[1])
(c_int::from(data[0]) << 8) | c_int::from(data[1])
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/types/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ impl<'py> PyAnyMethods<'py> for Bound<'py, PyAny> {
}
}

inner(self.py(), self.getattr(attr_name).map_err(Into::into))
inner(self.py(), self.getattr(attr_name))
}

fn getattr<N>(&self, attr_name: N) -> PyResult<Bound<'py, PyAny>>
Expand Down
2 changes: 1 addition & 1 deletion src/types/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ impl<'py> PyModuleMethods<'py> for Bound<'py, PyModule> {
Err(err) => {
if err.is_instance_of::<exceptions::PyAttributeError>(self.py()) {
let l = PyList::empty(self.py());
self.setattr(__all__, &l).map_err(PyErr::from)?;
self.setattr(__all__, &l)?;
Ok(l)
} else {
Err(err)
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/invalid_cancel_handle.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ error[E0277]: the trait bound `CancelHandle: PyFunctionArgument<'_, '_>` is not
--> tests/ui/invalid_cancel_handle.rs:20:50
|
20 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {}
| ^^^^ the trait `PyClass` is not implemented for `CancelHandle`, which is required by `CancelHandle: PyFunctionArgument<'_, '_>`
| ^^^^ the trait `PyClass` is not implemented for `CancelHandle`
|
= help: the trait `PyClass` is implemented for `pyo3::coroutine::Coroutine`
= note: required for `CancelHandle` to implement `FromPyObject<'_>`
Expand All @@ -61,7 +61,7 @@ error[E0277]: the trait bound `CancelHandle: PyFunctionArgument<'_, '_>` is not
--> tests/ui/invalid_cancel_handle.rs:20:50
|
20 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {}
| ^^^^ the trait `Clone` is not implemented for `CancelHandle`, which is required by `CancelHandle: PyFunctionArgument<'_, '_>`
| ^^^^ the trait `Clone` is not implemented for `CancelHandle`
|
= help: the following other types implement trait `PyFunctionArgument<'a, 'py>`:
&'a mut pyo3::coroutine::Coroutine
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/invalid_property_args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ error[E0277]: `PhantomData<i32>` cannot be converted to a Python object
45 | value: ::std::marker::PhantomData<i32>,
| ^ required by `#[pyo3(get)]` to create a readable property from a field of type `PhantomData<i32>`
|
= help: the trait `IntoPyObject<'_>` is not implemented for `PhantomData<i32>`, which is required by `for<'py> PhantomData<i32>: PyO3GetField<'py>`
= help: the trait `IntoPyObject<'_>` is not implemented for `PhantomData<i32>`
= note: implement `IntoPyObject` for `&PhantomData<i32>` or `IntoPyObject + Clone` for `PhantomData<i32>` to define the conversion
= help: the following other types implement trait `IntoPyObject<'py>`:
&&'a T
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/invalid_pycallargs.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ note: required by a bound in `call1`
| where
| A: PyCallArgs<'py>;
| ^^^^^^^^^^^^^^^ required by this bound in `PyAnyMethods::call1`
help: use a unary tuple instead
|
6 | any.call1(("foo",));
| + ++
8 changes: 4 additions & 4 deletions tests/ui/invalid_pyclass_args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,21 @@ error: expected one of: `get`, `set`, `name`
85 | #[pyo3(pop)]
| ^^^

error: invalid format string: expected `'}'` but string was terminated
error: invalid format string: expected `}` but string was terminated
--> tests/ui/invalid_pyclass_args.rs:105:19
|
105 | #[pyclass(str = "{")]
| -^ expected `'}'` in format string
| -^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`

error: invalid format string: expected `'}'`, found `'$'`
error: invalid format string: expected `}`, found `$`
--> tests/ui/invalid_pyclass_args.rs:109:19
|
109 | #[pyclass(str = "{$}")]
| -^ expected `'}'` in format string
| -^ expected `}` in format string
| |
| because of this opening brace
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/invalid_pyfunctions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ error[E0277]: the trait bound `&str: From<BoundRef<'_, '_, pyo3::types::PyModule
--> tests/ui/invalid_pyfunctions.rs:33:14
|
33 | _string: &str,
| ^ the trait `From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not implemented for `&str`, which is required by `BoundRef<'_, '_, pyo3::types::PyModule>: Into<_>`
| ^ the trait `From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not implemented for `&str`
|
= help: the following other types implement trait `From<T>`:
`String` implements `From<&String>`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/invalid_pymethod_receiver.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0277]: the trait bound `i32: TryFrom<BoundRef<'_, '_, MyClass>>` is not s
--> tests/ui/invalid_pymethod_receiver.rs:8:44
|
8 | fn method_with_invalid_self_type(_slf: i32, _py: Python<'_>, _index: u32) {}
| ^^^ the trait `From<BoundRef<'_, '_, MyClass>>` is not implemented for `i32`, which is required by `i32: TryFrom<BoundRef<'_, '_, MyClass>>`
| ^^^ the trait `From<BoundRef<'_, '_, MyClass>>` is not implemented for `i32`
|
= help: the following other types implement trait `From<T>`:
`i32` implements `From<bool>`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/invalid_pymethods.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ error[E0277]: the trait bound `i32: From<BoundRef<'_, '_, PyType>>` is not satis
--> tests/ui/invalid_pymethods.rs:46:45
|
46 | fn classmethod_wrong_first_argument(_x: i32) -> Self {
| ^^^ the trait `From<BoundRef<'_, '_, PyType>>` is not implemented for `i32`, which is required by `BoundRef<'_, '_, PyType>: Into<_>`
| ^^^ the trait `From<BoundRef<'_, '_, PyType>>` is not implemented for `i32`
|
= help: the following other types implement trait `From<T>`:
`i32` implements `From<bool>`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/invalid_result_conversion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0277]: the trait bound `PyErr: From<MyError>` is not satisfied
--> tests/ui/invalid_result_conversion.rs:22:25
|
22 | fn should_not_work() -> Result<(), MyError> {
| ^^^^^^ the trait `From<MyError>` is not implemented for `PyErr`, which is required by `MyError: Into<PyErr>`
| ^^^^^^ the trait `From<MyError>` is not implemented for `PyErr`
|
= help: the following other types implement trait `From<T>`:
`PyErr` implements `From<AddrParseError>`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/not_send.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
| |
| required by a bound introduced by this call
|
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`, which is required by `{closure@$DIR/tests/ui/not_send.rs:4:22: 4:24}: Ungil`
= 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>>`
--> $RUST/core/src/marker.rs
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/not_send2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
10 | | });
| |_________^ `*mut pyo3::Python<'static>` cannot be shared between threads safely
|
= help: within `pyo3::Bound<'_, PyString>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`, which is required by `{closure@$DIR/tests/ui/not_send2.rs:8:26: 8:28}: Ungil`
= help: within `pyo3::Bound<'_, PyString>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
--> $RUST/core/src/marker.rs
|
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/pyclass_send.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0277]: `*mut c_void` cannot be shared between threads safely
5 | struct NotSyncNotSend(*mut c_void);
| ^^^^^^^^^^^^^^ `*mut c_void` cannot be shared between threads safely
|
= help: within `NotSyncNotSend`, the trait `Sync` is not implemented for `*mut c_void`, which is required by `NotSyncNotSend: Sync`
= help: within `NotSyncNotSend`, the trait `Sync` is not implemented for `*mut c_void`
note: required because it appears within the type `NotSyncNotSend`
--> tests/ui/pyclass_send.rs:5:8
|
Expand All @@ -25,7 +25,7 @@ error[E0277]: `*mut c_void` cannot be sent between threads safely
4 | #[pyclass]
| ^^^^^^^^^^ `*mut c_void` cannot be sent between threads safely
|
= help: within `NotSyncNotSend`, the trait `Send` is not implemented for `*mut c_void`, which is required by `SendablePyClass<NotSyncNotSend>: pyo3::impl_::pyclass::PyClassThreadChecker<NotSyncNotSend>`
= help: within `NotSyncNotSend`, the trait `Send` is not implemented for `*mut c_void`
= help: the trait `pyo3::impl_::pyclass::PyClassThreadChecker<T>` is implemented for `SendablePyClass<T>`
note: required because it appears within the type `NotSyncNotSend`
--> tests/ui/pyclass_send.rs:5:8
Expand All @@ -46,7 +46,7 @@ error[E0277]: `*mut c_void` cannot be shared between threads safely
8 | struct SendNotSync(*mut c_void);
| ^^^^^^^^^^^ `*mut c_void` cannot be shared between threads safely
|
= help: within `SendNotSync`, the trait `Sync` is not implemented for `*mut c_void`, which is required by `SendNotSync: Sync`
= help: within `SendNotSync`, the trait `Sync` is not implemented for `*mut c_void`
note: required because it appears within the type `SendNotSync`
--> tests/ui/pyclass_send.rs:8:8
|
Expand All @@ -67,7 +67,7 @@ error[E0277]: `*mut c_void` cannot be sent between threads safely
11 | #[pyclass]
| ^^^^^^^^^^ `*mut c_void` cannot be sent between threads safely
|
= help: within `SyncNotSend`, the trait `Send` is not implemented for `*mut c_void`, which is required by `SendablePyClass<SyncNotSend>: pyo3::impl_::pyclass::PyClassThreadChecker<SyncNotSend>`
= help: within `SyncNotSend`, the trait `Send` is not implemented for `*mut c_void`
= help: the trait `pyo3::impl_::pyclass::PyClassThreadChecker<T>` is implemented for `SendablePyClass<T>`
note: required because it appears within the type `SyncNotSend`
--> tests/ui/pyclass_send.rs:12:8
Expand All @@ -88,7 +88,7 @@ error[E0277]: `*mut c_void` cannot be sent between threads safely
4 | #[pyclass]
| ^^^^^^^^^^ `*mut c_void` cannot be sent between threads safely
|
= help: within `NotSyncNotSend`, the trait `Send` is not implemented for `*mut c_void`, which is required by `NotSyncNotSend: Send`
= help: within `NotSyncNotSend`, the trait `Send` is not implemented for `*mut c_void`
note: required because it appears within the type `NotSyncNotSend`
--> tests/ui/pyclass_send.rs:5:8
|
Expand All @@ -107,7 +107,7 @@ error[E0277]: `*mut c_void` cannot be sent between threads safely
11 | #[pyclass]
| ^^^^^^^^^^ `*mut c_void` cannot be sent between threads safely
|
= help: within `SyncNotSend`, the trait `Send` is not implemented for `*mut c_void`, which is required by `SyncNotSend: Send`
= help: within `SyncNotSend`, the trait `Send` is not implemented for `*mut c_void`
note: required because it appears within the type `SyncNotSend`
--> tests/ui/pyclass_send.rs:12:8
|
Expand Down

0 comments on commit 1840bc5

Please sign in to comment.