ffi: field fixes from pyo3-ffi-check

This commit is contained in:
David Hewitt 2022-06-05 08:17:14 +01:00
parent f8d58f57c3
commit 9300bff551
5 changed files with 55 additions and 25 deletions

View File

@ -50,6 +50,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix FFI definition `PyFrameObject` having multiple incorrect members on various Python versions. [#2424](https://github.com/PyO3/pyo3/pull/2424) - 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. [#2428](https://github.com/PyO3/pyo3/pull/2428) - Fix FFI definition `PyTypeObject` missing deprecated field `tp_print` on Python 3.8. [#2428](https://github.com/PyO3/pyo3/pull/2428)
- Fix FFI definitions `PyDateTime_CAPI`. `PyDateTime_Date`, `PyASCIIObject`, `PyBaseExceptionObject`, `PyListObject`, and `PyTypeObject` on PyPy. [#2428](https://github.com/PyO3/pyo3/pull/2428) - Fix FFI definitions `PyDateTime_CAPI`. `PyDateTime_Date`, `PyASCIIObject`, `PyBaseExceptionObject`, `PyListObject`, and `PyTypeObject` on PyPy. [#2428](https://github.com/PyO3/pyo3/pull/2428)
- Fix FFI definition `_inittab` field `initfunc` typo'd as `initfun`. [#2431](https://github.com/PyO3/pyo3/pull/2431)
- Fix FFI definitions `_PyDateTime_BaseTime` and `_PyDateTime_BaseDateTime` incorrectly having `fold` member. [#2432](https://github.com/PyO3/pyo3/pull/2432)
## [0.16.5] - 2022-05-15 ## [0.16.5] - 2022-05-15

View File

@ -11,13 +11,15 @@ use std::os::raw::{c_char, c_int, c_uchar, c_void};
#[cfg(all(Py_3_8, not(PyPy), not(Py_3_11)))] #[cfg(all(Py_3_8, not(PyPy), not(Py_3_11)))]
opaque_struct!(_PyOpcache); opaque_struct!(_PyOpcache);
#[cfg(all(not(PyPy), not(Py_3_8)))]
opaque_struct!(PyCodeObject);
#[cfg(all(not(PyPy), Py_3_8, not(Py_3_11)))] #[cfg(all(not(PyPy), Py_3_8, not(Py_3_11)))]
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct PyCodeObject { pub struct PyCodeObject {
pub ob_base: PyObject, pub ob_base: PyObject,
pub co_argcount: c_int, pub co_argcount: c_int,
#[cfg(Py_3_8)]
pub co_posonlyargcount: c_int, pub co_posonlyargcount: c_int,
pub co_kwonlyargcount: c_int, pub co_kwonlyargcount: c_int,
pub co_nlocals: c_int, pub co_nlocals: c_int,
@ -40,13 +42,9 @@ pub struct PyCodeObject {
pub co_zombieframe: *mut c_void, pub co_zombieframe: *mut c_void,
pub co_weakreflist: *mut PyObject, pub co_weakreflist: *mut PyObject,
pub co_extra: *mut c_void, pub co_extra: *mut c_void,
#[cfg(Py_3_8)]
pub co_opcache_map: *mut c_uchar, pub co_opcache_map: *mut c_uchar,
#[cfg(all(Py_3_8, not(Py_3_11)))]
pub co_opcache: *mut _PyOpcache, pub co_opcache: *mut _PyOpcache,
#[cfg(Py_3_8)]
pub co_opcache_flag: c_int, pub co_opcache_flag: c_int,
#[cfg(Py_3_8)]
pub co_opcache_size: c_uchar, pub co_opcache_size: c_uchar,
} }
@ -81,9 +79,6 @@ pub struct PyCodeObject {
pub co_code_adaptive: [c_char; 1], pub co_code_adaptive: [c_char; 1],
} }
#[cfg(all(not(PyPy), Py_3_7, not(Py_3_8)))]
opaque_struct!(PyCodeObject);
#[cfg(PyPy)] #[cfg(PyPy)]
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]

View File

@ -1,19 +1,14 @@
use crate::object::*; use crate::object::*;
use crate::PyFrameObject; use crate::PyFrameObject;
#[cfg(not(PyPy))] #[cfg(not(PyPy))]
use crate::{Py_ssize_t, _PyErr_StackItem}; use crate::_PyErr_StackItem;
use std::os::raw::c_int; use std::os::raw::c_int;
#[cfg(not(PyPy))] #[cfg(not(PyPy))]
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct PyGenObject { pub struct PyGenObject {
#[cfg(py_sys_config = "Py_TRACE_REFS")] pub ob_base: PyObject,
pub _ob_next: *mut PyObject,
#[cfg(py_sys_config = "Py_TRACE_REFS")]
pub _ob_prev: *mut PyObject,
pub ob_refcnt: Py_ssize_t,
pub ob_type: *mut PyTypeObject,
pub gi_frame: *mut PyFrameObject, pub gi_frame: *mut PyFrameObject,
#[cfg(not(Py_3_10))] #[cfg(not(Py_3_10))]
pub gi_running: c_int, pub gi_running: c_int,

View File

@ -24,7 +24,14 @@ pub struct PyBaseExceptionObject {
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct PySyntaxErrorObject { pub struct PySyntaxErrorObject {
pub exception_base: PyBaseExceptionObject, pub ob_base: PyObject,
pub dict: *mut PyObject,
pub args: *mut PyObject,
pub traceback: *mut PyObject,
pub context: *mut PyObject,
pub cause: *mut PyObject,
pub suppress_context: char,
pub msg: *mut PyObject, pub msg: *mut PyObject,
pub filename: *mut PyObject, pub filename: *mut PyObject,
pub lineno: *mut PyObject, pub lineno: *mut PyObject,
@ -41,7 +48,14 @@ pub struct PySyntaxErrorObject {
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct PyImportErrorObject { pub struct PyImportErrorObject {
pub exception_base: PyBaseExceptionObject, pub ob_base: PyObject,
pub dict: *mut PyObject,
pub args: *mut PyObject,
pub traceback: *mut PyObject,
pub context: *mut PyObject,
pub cause: *mut PyObject,
pub suppress_context: char,
pub msg: *mut PyObject, pub msg: *mut PyObject,
pub name: *mut PyObject, pub name: *mut PyObject,
pub path: *mut PyObject, pub path: *mut PyObject,
@ -51,7 +65,14 @@ pub struct PyImportErrorObject {
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct PyUnicodeErrorObject { pub struct PyUnicodeErrorObject {
pub exception_base: PyBaseExceptionObject, pub ob_base: PyObject,
pub dict: *mut PyObject,
pub args: *mut PyObject,
pub traceback: *mut PyObject,
pub context: *mut PyObject,
pub cause: *mut PyObject,
pub suppress_context: char,
pub encoding: *mut PyObject, pub encoding: *mut PyObject,
pub object: *mut PyObject, pub object: *mut PyObject,
pub start: Py_ssize_t, pub start: Py_ssize_t,
@ -63,7 +84,14 @@ pub struct PyUnicodeErrorObject {
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct PySystemExitObject { pub struct PySystemExitObject {
pub exception_base: PyBaseExceptionObject, pub ob_base: PyObject,
pub dict: *mut PyObject,
pub args: *mut PyObject,
pub traceback: *mut PyObject,
pub context: *mut PyObject,
pub cause: *mut PyObject,
pub suppress_context: char,
pub code: *mut PyObject, pub code: *mut PyObject,
} }
@ -71,7 +99,14 @@ pub struct PySystemExitObject {
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct PyOSErrorObject { pub struct PyOSErrorObject {
pub exception_base: PyBaseExceptionObject, pub ob_base: PyObject,
pub dict: *mut PyObject,
pub args: *mut PyObject,
pub traceback: *mut PyObject,
pub context: *mut PyObject,
pub cause: *mut PyObject,
pub suppress_context: char,
pub myerrno: *mut PyObject, pub myerrno: *mut PyObject,
pub strerror: *mut PyObject, pub strerror: *mut PyObject,
pub filename: *mut PyObject, pub filename: *mut PyObject,
@ -84,7 +119,14 @@ pub struct PyOSErrorObject {
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct PyStopIterationObject { pub struct PyStopIterationObject {
pub exception_base: PyBaseExceptionObject, pub ob_base: PyObject,
pub dict: *mut PyObject,
pub args: *mut PyObject,
pub traceback: *mut PyObject,
pub context: *mut PyObject,
pub cause: *mut PyObject,
pub suppress_context: char,
pub value: *mut PyObject, pub value: *mut PyObject,
} }

View File

@ -51,8 +51,6 @@ pub struct _PyDateTime_BaseTime {
pub hastzinfo: c_char, pub hastzinfo: c_char,
#[cfg(not(PyPy))] #[cfg(not(PyPy))]
pub data: [c_uchar; _PyDateTime_TIME_DATASIZE], pub data: [c_uchar; _PyDateTime_TIME_DATASIZE],
#[cfg(not(PyPy))]
pub fold: c_uchar,
} }
#[repr(C)] #[repr(C)]
@ -98,8 +96,6 @@ pub struct _PyDateTime_BaseDateTime {
pub hastzinfo: c_char, pub hastzinfo: c_char,
#[cfg(not(PyPy))] #[cfg(not(PyPy))]
pub data: [c_uchar; _PyDateTime_DATETIME_DATASIZE], pub data: [c_uchar; _PyDateTime_DATETIME_DATASIZE],
#[cfg(not(PyPy))]
pub fold: c_uchar,
} }
#[repr(C)] #[repr(C)]