ffi: many fixes caught by pyo3-ffi-check
This commit is contained in:
parent
62e110cdcf
commit
78cdc6d6ad
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Add macro `append_to_inittab`. [#2377](https://github.com/PyO3/pyo3/pull/2377)
|
||||
- Add FFI definition `PyFrame_GetCode`. [#2406](https://github.com/PyO3/pyo3/pull/2406)
|
||||
- Added `PyCode` and `PyFrame` high level objects. [#2408](https://github.com/PyO3/pyo3/pull/2408)
|
||||
- Add FFI definitions `Py_fstring_input`, `sendfunc`, and `_PyErr_StackItem`. [#2423](https://github.com/PyO3/pyo3/pull/2423)
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -40,6 +41,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- 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)
|
||||
- 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)
|
||||
- Fix FFI definition `PyGenObject` having multiple incorrect members on various Python versions. [#2423](https://github.com/PyO3/pyo3/pull/2423)
|
||||
- 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)
|
||||
|
||||
## [0.16.5] - 2022-05-15
|
||||
|
||||
|
|
|
@ -5,4 +5,6 @@ pub const Py_file_input: c_int = 257;
|
|||
pub const Py_eval_input: c_int = 258;
|
||||
#[cfg(Py_3_8)]
|
||||
pub const Py_func_type_input: c_int = 345;
|
||||
// skipped Py_fstring_input
|
||||
|
||||
#[cfg(Py_3_9)]
|
||||
pub const Py_fstring_input: c_int = 800;
|
||||
|
|
|
@ -20,7 +20,14 @@ use std::os::raw::c_int;
|
|||
// skipped non-limited PyCF_ALLOW_TOP_LEVEL_AWAIT
|
||||
// skipped non-limited PyCF_COMPILE_MASK
|
||||
|
||||
// skipped non-limited PyCompilerFlags
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct PyCompilerFlags {
|
||||
pub cf_flags: c_int,
|
||||
#[cfg(Py_3_8)]
|
||||
pub cf_feature_version: c_int,
|
||||
}
|
||||
|
||||
// skipped non-limited _PyCompilerFlags_INIT
|
||||
|
||||
#[repr(C)]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::object::*;
|
||||
use crate::pyport::Py_ssize_t;
|
||||
use crate::PyFrameObject;
|
||||
use crate::{PyFrameObject, _PyErr_StackItem};
|
||||
use std::os::raw::c_int;
|
||||
|
||||
#[repr(C)]
|
||||
|
@ -13,9 +13,13 @@ pub struct PyGenObject {
|
|||
pub ob_refcnt: Py_ssize_t,
|
||||
pub ob_type: *mut PyTypeObject,
|
||||
pub gi_frame: *mut PyFrameObject,
|
||||
#[cfg(not(Py_3_10))]
|
||||
pub gi_running: c_int,
|
||||
pub gi_code: *mut PyObject,
|
||||
pub gi_weakreflist: *mut PyObject,
|
||||
pub gi_name: *mut PyObject,
|
||||
pub gi_qualname: *mut PyObject,
|
||||
pub gi_exc_state: _PyErr_StackItem,
|
||||
}
|
||||
|
||||
#[cfg_attr(windows, link(name = "pythonXY"))]
|
|
@ -11,6 +11,7 @@ pub(crate) mod dictobject;
|
|||
// skipped fileobject.h
|
||||
// skipped fileutils.h
|
||||
pub(crate) mod frameobject;
|
||||
pub(crate) mod genobject;
|
||||
pub(crate) mod import;
|
||||
#[cfg(all(Py_3_8, not(PyPy)))]
|
||||
pub(crate) mod initconfig;
|
||||
|
@ -18,6 +19,7 @@ pub(crate) mod initconfig;
|
|||
pub(crate) mod listobject;
|
||||
pub(crate) mod object;
|
||||
pub(crate) mod pydebug;
|
||||
pub(crate) mod pyerrors;
|
||||
#[cfg(all(Py_3_8, not(PyPy)))]
|
||||
pub(crate) mod pylifecycle;
|
||||
pub(crate) mod pymem;
|
||||
|
@ -37,12 +39,14 @@ pub use self::compile::*;
|
|||
#[cfg(not(PyPy))]
|
||||
pub use self::dictobject::*;
|
||||
pub use self::frameobject::*;
|
||||
pub use self::genobject::*;
|
||||
pub use self::import::*;
|
||||
#[cfg(all(Py_3_8, not(PyPy)))]
|
||||
pub use self::initconfig::*;
|
||||
pub use self::listobject::*;
|
||||
pub use self::object::*;
|
||||
pub use self::pydebug::*;
|
||||
pub use self::pyerrors::*;
|
||||
#[cfg(all(Py_3_8, not(PyPy)))]
|
||||
pub use self::pylifecycle::*;
|
||||
pub use self::pymem::*;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use crate::PyObject;
|
||||
use std::os::raw::c_int;
|
||||
use crate::object;
|
||||
use crate::{PyObject, Py_ssize_t};
|
||||
use std::mem;
|
||||
use std::os::raw::{c_char, c_int, c_uint, c_ulong, c_void};
|
||||
|
||||
// skipped _Py_NewReference
|
||||
// skipped _Py_ForgetReference
|
||||
|
@ -118,12 +120,6 @@ pub type vectorcallfunc = unsafe extern "C" fn(
|
|||
kwnames: *mut PyObject,
|
||||
) -> *mut PyObject;
|
||||
|
||||
mod typeobject {
|
||||
use crate::object;
|
||||
use crate::{PyObject, Py_ssize_t};
|
||||
use std::mem;
|
||||
use std::os::raw::{c_char, c_int, c_uint, c_ulong, c_void};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct PyNumberMethods {
|
||||
|
@ -188,7 +184,12 @@ mod typeobject {
|
|||
pub mp_ass_subscript: Option<object::objobjargproc>,
|
||||
}
|
||||
|
||||
// skipped PySendResult
|
||||
#[cfg(Py_3_10)]
|
||||
pub type sendfunc = unsafe extern "C" fn(
|
||||
iter: *mut PyObject,
|
||||
value: *mut PyObject,
|
||||
result: *mut *mut PyObject,
|
||||
) -> object::PySendResult;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Default)]
|
||||
|
@ -196,6 +197,8 @@ mod typeobject {
|
|||
pub am_await: Option<object::unaryfunc>,
|
||||
pub am_aiter: Option<object::unaryfunc>,
|
||||
pub am_anext: Option<object::unaryfunc>,
|
||||
#[cfg(Py_3_10)]
|
||||
pub am_send: Option<sendfunc>,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
|
@ -300,6 +303,8 @@ mod typeobject {
|
|||
pub ht_slots: *mut object::PyObject,
|
||||
pub ht_qualname: *mut object::PyObject,
|
||||
pub ht_cached_keys: *mut c_void,
|
||||
#[cfg(Py_3_9)]
|
||||
pub ht_module: *mut object::PyObject,
|
||||
}
|
||||
|
||||
impl Default for PyHeapTypeObject {
|
||||
|
@ -317,10 +322,6 @@ mod typeobject {
|
|||
let ptr = etype.offset((*py_type).tp_basicsize);
|
||||
ptr as *mut crate::structmember::PyMemberDef
|
||||
}
|
||||
}
|
||||
|
||||
// The exported types depend on whether Py_LIMITED_API is set
|
||||
pub use self::typeobject::*;
|
||||
|
||||
// skipped _PyType_Name
|
||||
// skipped _PyType_Lookup
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
use crate::{PyObject, Py_ssize_t};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct 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,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PySyntaxErrorObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub msg: *mut PyObject,
|
||||
pub filename: *mut PyObject,
|
||||
pub lineno: *mut PyObject,
|
||||
pub offset: *mut PyObject,
|
||||
#[cfg(Py_3_10)]
|
||||
pub end_lineno: *mut PyObject,
|
||||
#[cfg(Py_3_10)]
|
||||
pub end_offset: *mut PyObject,
|
||||
pub text: *mut PyObject,
|
||||
pub print_file_and_line: *mut PyObject,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PyImportErrorObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub msg: *mut PyObject,
|
||||
pub name: *mut PyObject,
|
||||
pub path: *mut PyObject,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PyUnicodeErrorObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub encoding: *mut PyObject,
|
||||
pub object: *mut PyObject,
|
||||
pub start: Py_ssize_t,
|
||||
pub end: Py_ssize_t,
|
||||
pub reason: *mut PyObject,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PySystemExitObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub code: *mut PyObject,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PyOSErrorObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub myerrno: *mut PyObject,
|
||||
pub strerror: *mut PyObject,
|
||||
pub filename: *mut PyObject,
|
||||
pub filename2: *mut PyObject,
|
||||
#[cfg(windows)]
|
||||
pub winerror: *mut PyObject,
|
||||
pub written: Py_ssize_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PyStopIterationObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub value: *mut PyObject,
|
||||
}
|
||||
|
||||
// skipped PyNameErrorObject
|
||||
// skipped PyAttributeErrorObject
|
||||
|
||||
// skipped PyEnvironmentErrorObject
|
||||
// skipped PyWindowsErrorObject
|
||||
|
||||
// skipped _PyErr_SetKeyError
|
||||
// skipped _PyErr_GetTopmostException
|
||||
// skipped _PyErr_GetExcInfo
|
||||
|
||||
// skipped _PyErr_ChainExceptions
|
||||
|
||||
// skipped PyErr_SetFromErrnoWithUnicodeFilename
|
||||
|
||||
// skipped _PyErr_FormatFromCause
|
||||
|
||||
// skipped PyErr_SetFromWindowsErrWithUnicodeFilename
|
||||
// skipped PyErr_SetExcFromWindowsErrWithUnicodeFilename
|
||||
|
||||
// skipped _PyErr_TrySetFromCause
|
||||
|
||||
// skipped PySignal_SetWakeupFd
|
||||
// skipped _PyErr_CheckSignals
|
||||
|
||||
// skipped PyErr_SyntaxLocationObject
|
||||
// skipped PyErr_RangedSyntaxLocationObject
|
||||
// skipped PyErr_ProgramTextObject
|
||||
|
||||
// skipped _PyErr_ProgramDecodedTextObject
|
||||
// skipped _PyUnicodeTranslateError_Create
|
||||
// skipped _PyErr_WriteUnraisableMsg
|
||||
// skipped _Py_FatalErrorFunc
|
||||
// skipped _Py_FatalErrorFormat
|
||||
// skipped Py_FatalError
|
|
@ -26,7 +26,16 @@ pub const PyTrace_OPCODE: c_int = 7;
|
|||
|
||||
// skipped PyTraceInfo
|
||||
// skipped CFrame
|
||||
// skipped _PyErr_StackItem
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct _PyErr_StackItem {
|
||||
pub exc_type: *mut PyObject,
|
||||
pub exc_value: *mut PyObject,
|
||||
pub exc_traceback: *mut PyObject,
|
||||
pub previous_item: *mut _PyErr_StackItem,
|
||||
}
|
||||
|
||||
// skipped _PyStackChunk
|
||||
// skipped _ts (aka PyThreadState)
|
||||
|
||||
|
|
|
@ -301,8 +301,6 @@ pub use self::fileutils::*;
|
|||
pub use self::floatobject::*;
|
||||
#[cfg(not(Py_LIMITED_API))]
|
||||
pub use self::funcobject::*;
|
||||
#[cfg(not(Py_LIMITED_API))]
|
||||
pub use self::genobject::*;
|
||||
pub use self::import::*;
|
||||
pub use self::intrcheck::*;
|
||||
pub use self::iterobject::*;
|
||||
|
@ -373,8 +371,6 @@ mod floatobject;
|
|||
#[cfg(not(Py_LIMITED_API))]
|
||||
pub(crate) mod funcobject;
|
||||
// skipped genericaliasobject.h
|
||||
#[cfg(not(Py_LIMITED_API))]
|
||||
mod genobject;
|
||||
mod import;
|
||||
// skipped interpreteridobject.h
|
||||
mod intrcheck;
|
||||
|
|
|
@ -2,77 +2,6 @@ use crate::object::*;
|
|||
use crate::pyport::Py_ssize_t;
|
||||
use std::os::raw::{c_char, c_int};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct 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,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PySyntaxErrorObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub msg: *mut PyObject,
|
||||
pub filename: *mut PyObject,
|
||||
pub lineno: *mut PyObject,
|
||||
pub offset: *mut PyObject,
|
||||
pub text: *mut PyObject,
|
||||
pub print_file_and_line: *mut PyObject,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PyImportErrorObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub msg: *mut PyObject,
|
||||
pub name: *mut PyObject,
|
||||
pub path: *mut PyObject,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PyUnicodeErrorObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub encoding: *mut PyObject,
|
||||
pub object: *mut PyObject,
|
||||
pub start: Py_ssize_t,
|
||||
pub end: Py_ssize_t,
|
||||
pub reason: *mut PyObject,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PySystemExitObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub code: *mut PyObject,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PyOSErrorObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub myerrno: *mut PyObject,
|
||||
pub strerror: *mut PyObject,
|
||||
pub filename: *mut PyObject,
|
||||
pub filename2: *mut PyObject,
|
||||
#[cfg(windows)]
|
||||
pub winerror: *mut PyObject,
|
||||
pub written: Py_ssize_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PyStopIterationObject {
|
||||
pub exception_base: PyBaseExceptionObject,
|
||||
pub value: *mut PyObject,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
#[cfg_attr(PyPy, link_name = "PyPyErr_SetNone")]
|
||||
pub fn PyErr_SetNone(arg1: *mut PyObject);
|
||||
|
|
|
@ -24,16 +24,6 @@ pub const PYOS_STACK_MARGIN: c_int = 2048;
|
|||
|
||||
// skipped PyOS_CheckStack under Microsoft C
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
#[cfg(not(Py_LIMITED_API))]
|
||||
pub struct PyCompilerFlags {
|
||||
pub cf_flags: c_int,
|
||||
}
|
||||
|
||||
#[cfg(Py_LIMITED_API)]
|
||||
opaque_struct!(PyCompilerFlags);
|
||||
|
||||
#[cfg(all(not(Py_LIMITED_API), not(Py_3_10)))]
|
||||
opaque_struct!(_mod);
|
||||
|
||||
|
|
Loading…
Reference in New Issue