From 67411047623e9f16c4181a9a2a46cd38cf45a894 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Thu, 2 Jun 2022 09:27:19 +0100 Subject: [PATCH 1/2] ffi: fix names of _Base datetime structs --- CHANGELOG.md | 1 + pyo3-ffi/src/datetime.rs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f8c5b0463f..39cddd3410a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix "raw-ident" structs (e.g. `#[pyclass] struct r#RawName`) incorrectly having `r#` at the start of the class name created in Python. [#2395](https://github.com/PyO3/pyo3/pull/2395) - Fix case where `ValueError` without message could be raised by the `#[derive(FromPyObject)]` generated implementation for a tuple struct. [#2414](https://github.com/PyO3/pyo3/pull/2414) - Fix compile failure when using `#[pyo3(from_py_with = "pouf")]` in on a field in a `#[derive(FromPyObject)]` struct. [#2414](https://github.com/PyO3/pyo3/pull/2414) +- Fix FFI definitions `_PyDateTime_BaseTime` lacking leading underscores in their names. [#2421](https://github.com/PyO3/pyo3/pull/2421) ## [0.16.5] - 2022-05-15 diff --git a/pyo3-ffi/src/datetime.rs b/pyo3-ffi/src/datetime.rs index 74f83bbf941..166a8f314b8 100644 --- a/pyo3-ffi/src/datetime.rs +++ b/pyo3-ffi/src/datetime.rs @@ -42,7 +42,7 @@ pub struct PyDateTime_Delta { #[repr(C)] #[derive(Debug, Copy, Clone)] /// Structure representing a `datetime.time` without a `tzinfo` member. -pub struct PyDateTime_BaseTime { +pub struct _PyDateTime_BaseTime { pub ob_base: PyObject, #[cfg(not(PyPy))] pub hashcode: Py_hash_t, @@ -60,7 +60,7 @@ pub struct PyDateTime_BaseTime { /// # Safety /// /// Care should be taken when reading the `tzinfo` field of this type. If the time does not have a -/// tzinfo then the Python interpreter is free to allocate it as a [PyDateTime_BaseTime]. +/// tzinfo then the Python interpreter is free to allocate it as a [_PyDateTime_BaseTime]. pub struct PyDateTime_Time { pub ob_base: PyObject, #[cfg(not(PyPy))] @@ -87,7 +87,7 @@ pub struct PyDateTime_Date { #[repr(C)] #[derive(Debug, Copy, Clone)] /// Structure representing a `datetime.datetime` without a `tzinfo` member. -pub struct PyDateTime_BaseDateTime { +pub struct _PyDateTime_BaseDateTime { pub ob_base: PyObject, #[cfg(not(PyPy))] pub hashcode: Py_hash_t, @@ -105,7 +105,7 @@ pub struct PyDateTime_BaseDateTime { /// # Safety /// /// Care should be taken when reading the `tzinfo` field of this type. If the datetime does not have a -/// tzinfo then the Python interpreter is free to allocate it as a [PyDateTime_BaseDateTime]. +/// tzinfo then the Python interpreter is free to allocate it as a [_PyDateTime_BaseDateTime]. pub struct PyDateTime_DateTime { pub ob_base: PyObject, #[cfg(not(PyPy))] From 6a9f5fd705ea2437835849304cf2bb0f473dab91 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Thu, 2 Jun 2022 09:32:31 +0100 Subject: [PATCH 2/2] ffi: remove PyArena on 3.10 and up --- CHANGELOG.md | 1 + pyo3-ffi/src/lib.rs | 4 ++-- src/marker.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39cddd3410a..dc08401005c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix case where `ValueError` without message could be raised by the `#[derive(FromPyObject)]` generated implementation for a tuple struct. [#2414](https://github.com/PyO3/pyo3/pull/2414) - Fix compile failure when using `#[pyo3(from_py_with = "pouf")]` in on a field in a `#[derive(FromPyObject)]` struct. [#2414](https://github.com/PyO3/pyo3/pull/2414) - Fix FFI definitions `_PyDateTime_BaseTime` lacking leading underscores in their names. [#2421](https://github.com/PyO3/pyo3/pull/2421) +- Remove FFI definition `PyArena` on Python 3.10 and up. [#2421](https://github.com/PyO3/pyo3/pull/2421) ## [0.16.5] - 2022-05-15 diff --git a/pyo3-ffi/src/lib.rs b/pyo3-ffi/src/lib.rs index 9eabd846c69..7033c37eafd 100644 --- a/pyo3-ffi/src/lib.rs +++ b/pyo3-ffi/src/lib.rs @@ -316,7 +316,7 @@ pub use self::moduleobject::*; pub use self::object::*; pub use self::objimpl::*; pub use self::osmodule::*; -#[cfg(not(Py_LIMITED_API))] +#[cfg(not(any(Py_LIMITED_API, Py_3_10)))] pub use self::pyarena::*; pub use self::pycapsule::*; pub use self::pyerrors::*; @@ -399,7 +399,7 @@ mod osmodule; // skipped picklebufobject.h // skipped pyctype.h // skipped py_curses.h -#[cfg(not(Py_LIMITED_API))] +#[cfg(not(any(Py_LIMITED_API, Py_3_10)))] mod pyarena; mod pycapsule; // skipped pydecimal.h diff --git a/src/marker.rs b/src/marker.rs index 79b5489f573..6c27833bee5 100644 --- a/src/marker.rs +++ b/src/marker.rs @@ -184,7 +184,7 @@ mod negative_impls { impl !Ungil for crate::ffi::PyCodeObject {} #[cfg(not(Py_LIMITED_API))] impl !Ungil for crate::ffi::PyDictKeysObject {} - #[cfg(not(Py_LIMITED_API))] + #[cfg(not(any(Py_LIMITED_API, Py_3_10)))] impl !Ungil for crate::ffi::PyArena {} }