ffi: fix PyTypeObject definition on Python 3.8

This commit is contained in:
David Hewitt 2022-06-04 08:12:27 +01:00
parent e9012fed63
commit 0d78e88b14
4 changed files with 7 additions and 4 deletions

View File

@ -39,7 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Correct FFI definition `Py_tracefunc` to be `unsafe extern "C" fn` (was previously safe). [#2407](https://github.com/PyO3/pyo3/pull/2407)
- 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)
- Fix FFI definitions `_PyDateTime_BaseTime` and `_PyDateTime_BaseDateTime` 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)
- Fix FFI definition `PyCompilerFlags` missing member `cf_feature_version` on Python 3.8 and up. [#2423](https://github.com/PyO3/pyo3/pull/2423)
- Fix FFI definition `PyAsyncMethods` missing member `am_send` on Python 3.10 and up. [#2423](https://github.com/PyO3/pyo3/pull/2423)
@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix FFI definition `PySyntaxErrorObject` missing members `end_lineno` and `end_offset` on Python 3.10 and up. [#2423](https://github.com/PyO3/pyo3/pull/2423)
- Fix FFI definition `PyHeapTypeObject` missing member `ht_module` on Python 3.9 and up. [#2423](https://github.com/PyO3/pyo3/pull/2423)
- Fix FFI definition `PyFrameObject` having multiple incorrect members on various Python versions. [#2424](https://github.com/PyO3/pyo3/pull/2424)
- Fix FFI definition `PyTypeObject` missing deprecated field `tp_print` on Python 3.8. [#2424](https://github.com/PyO3/pyo3/pull/2424)
## [0.16.5] - 2022-05-15

View File

@ -6,7 +6,7 @@ use std::os::raw::{c_char, c_int, c_uchar, c_void};
// skipped _Py_OPCODE
// skipped _Py_OPARG
#[cfg(Py_3_8)]
#[cfg(all(Py_3_8, not(Py_3_11)))]
opaque_struct!(_PyOpcache);
#[repr(C)]

View File

@ -3,12 +3,12 @@ use crate::object::*;
use crate::pystate::PyThreadState;
use std::os::raw::{c_char, c_int};
// skipped _framestate
#[cfg(not(Py_3_11))]
pub type PyFrameState = c_char;
#[repr(C)]
#[derive(Copy, Clone)]
#[cfg(not(Py_3_11))]
pub struct PyTryBlock {
pub b_type: c_int,
pub b_handler: c_int,

View File

@ -276,6 +276,8 @@ pub struct PyTypeObject {
pub tp_finalize: Option<object::destructor>,
#[cfg(Py_3_8)]
pub tp_vectorcall: Option<super::vectorcallfunc>,
#[cfg(all(Py_3_8, not(Py_3_9)))]
pub tp_print: Option<printfunc>,
#[cfg(PyPy)]
pub tp_pypy_flags: std::os::raw::c_long,
#[cfg(py_sys_config = "COUNT_ALLOCS")]