Skip to content

Commit

Permalink
ffi: many fixes caught by pyo3-ffi-check
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Jun 2, 2022
1 parent 62e110c commit 60dfc89
Show file tree
Hide file tree
Showing 11 changed files with 337 additions and 282 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand All @@ -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

Expand Down
4 changes: 3 additions & 1 deletion pyo3-ffi/src/compile.rs
Expand Up @@ -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;
9 changes: 8 additions & 1 deletion pyo3-ffi/src/cpython/compile.rs
Expand Up @@ -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)]
Expand Down
@@ -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)]
Expand All @@ -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"))]
Expand Down
4 changes: 4 additions & 0 deletions pyo3-ffi/src/cpython/mod.rs
Expand Up @@ -11,13 +11,15 @@ 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;
// skipped interpreteridobject.h
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;
Expand All @@ -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::*;
Expand Down

0 comments on commit 60dfc89

Please sign in to comment.