diff --git a/noxfile.py b/noxfile.py index d16227c36ec..8ab8d9ec545 100644 --- a/noxfile.py +++ b/noxfile.py @@ -499,6 +499,7 @@ def set_minimal_package_versions(session: nox.Session): "trybuild": "1.0.76", # pins to avoid syn 2.0 (which requires Rust 1.56) "ghost": "0.1.8", + "serde_json": "1.0.99", "serde": "1.0.156", "serde_derive": "1.0.156", "cxx": "1.0.92", @@ -508,6 +509,9 @@ def set_minimal_package_versions(session: nox.Session): "js-sys": "0.3.61", "wasm-bindgen": "0.2.84", "syn": "1.0.109", + # proc-macro2 1.0.66+ is edition 2021 + "quote": "1.0.30", + "proc-macro2": "1.0.65", } # run cargo update first to ensure that everything is at highest # possible version, so that this matches what CI will resolve to. diff --git a/pyo3-ffi/src/cpython/abstract_.rs b/pyo3-ffi/src/cpython/abstract_.rs index dd029f3324a..d2e3ca9d67a 100644 --- a/pyo3-ffi/src/cpython/abstract_.rs +++ b/pyo3-ffi/src/cpython/abstract_.rs @@ -41,11 +41,11 @@ extern "C" { ) -> *mut PyObject; } -#[cfg(all(Py_3_8))] +#[cfg(Py_3_8)] const PY_VECTORCALL_ARGUMENTS_OFFSET: Py_ssize_t = 1 << (8 * std::mem::size_of::() as Py_ssize_t - 1); -#[cfg(all(Py_3_8))] +#[cfg(Py_3_8)] #[inline(always)] pub unsafe fn PyVectorcall_NARGS(n: size_t) -> Py_ssize_t { assert!(n <= (PY_SSIZE_T_MAX as size_t)); @@ -113,7 +113,7 @@ extern "C" { kwnames: *mut PyObject, ) -> *mut PyObject; - #[cfg(all(Py_3_8))] + #[cfg(Py_3_8)] #[cfg_attr(all(not(PyPy), not(Py_3_9)), link_name = "_PyObject_VectorcallDict")] #[cfg_attr(all(PyPy, not(Py_3_9)), link_name = "_PyPyObject_VectorcallDict")] #[cfg_attr(all(PyPy, Py_3_9), link_name = "PyPyObject_VectorcallDict")] @@ -124,7 +124,7 @@ extern "C" { kwdict: *mut PyObject, ) -> *mut PyObject; - #[cfg(all(Py_3_8))] + #[cfg(Py_3_8)] #[cfg_attr(not(any(Py_3_9, PyPy)), link_name = "_PyVectorcall_Call")] #[cfg_attr(PyPy, link_name = "PyPyVectorcall_Call")] pub fn PyVectorcall_Call( diff --git a/pyo3-ffi/src/object.rs b/pyo3-ffi/src/object.rs index 6ff8beb5a9e..4c53dc7a441 100644 --- a/pyo3-ffi/src/object.rs +++ b/pyo3-ffi/src/object.rs @@ -111,8 +111,8 @@ pub unsafe fn Py_TYPE(ob: *mut PyObject) -> *mut PyTypeObject { #[inline] pub unsafe fn Py_SIZE(ob: *mut PyObject) -> Py_ssize_t { - debug_assert_ne!((*ob).ob_type, std::ptr::addr_of_mut!(crate::PyLong_Type)); - debug_assert_ne!((*ob).ob_type, std::ptr::addr_of_mut!(crate::PyBool_Type)); + debug_assert_ne!((*ob).ob_type, addr_of_mut_shim!(crate::PyLong_Type)); + debug_assert_ne!((*ob).ob_type, addr_of_mut_shim!(crate::PyBool_Type)); (*ob.cast::()).ob_size } diff --git a/pyo3-macros-backend/src/method.rs b/pyo3-macros-backend/src/method.rs index b290fd55c13..2e2f75d18af 100644 --- a/pyo3-macros-backend/src/method.rs +++ b/pyo3-macros-backend/src/method.rs @@ -254,8 +254,8 @@ pub fn parse_method_receiver(arg: &syn::FnArg) -> Result { ) => { bail_spanned!(recv.span() => RECEIVER_BY_VALUE_ERR); } - syn::FnArg::Receiver(recv @ syn::Receiver { mutability, .. }) => Ok(SelfType::Receiver { - mutable: mutability.is_some(), + syn::FnArg::Receiver(recv) => Ok(SelfType::Receiver { + mutable: recv.mutability.is_some(), span: recv.span(), }), syn::FnArg::Typed(syn::PatType { ty, .. }) => { diff --git a/pytests/src/pyclasses.rs b/pytests/src/pyclasses.rs index 3ee61b343b0..b9c7a5beb48 100644 --- a/pytests/src/pyclasses.rs +++ b/pytests/src/pyclasses.rs @@ -16,6 +16,7 @@ impl EmptyClass { /// This is for demonstrating how to return a value from __next__ #[pyclass] +#[derive(Default)] struct PyClassIter { count: usize, } diff --git a/src/test_hygiene/pyclass.rs b/src/test_hygiene/pyclass.rs index 0b535abe860..4d07009cad6 100644 --- a/src/test_hygiene/pyclass.rs +++ b/src/test_hygiene/pyclass.rs @@ -56,6 +56,6 @@ pub struct Foo4 { field: i32, #[pyo3(get, set)] - #[cfg(any(not(FALSE)))] + #[cfg(not(FALSE))] field: u32, }