Skip to content

Commit

Permalink
ffi: fix PyTypeObject definition on Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Jun 4, 2022
1 parent e9012fe commit 0d78e88
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -39,14 +39,15 @@ 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)
- 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)
- 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

Expand Down
2 changes: 1 addition & 1 deletion pyo3-ffi/src/cpython/code.rs
Expand Up @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions pyo3-ffi/src/cpython/frameobject.rs
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions pyo3-ffi/src/cpython/object.rs
Expand Up @@ -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")]
Expand Down

0 comments on commit 0d78e88

Please sign in to comment.