Skip to content

Commit 8b88136

Browse files
committed
Closer match of PyObject's definition in 3.15t
1 parent 9fe421a commit 8b88136

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pyo3-ffi/src/object.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ impl std::fmt::Debug for PyObjectObRefcnt {
7474
#[cfg(all(not(Py_3_12), not(Py_GIL_DISABLED)))]
7575
pub type PyObjectObRefcnt = Py_ssize_t;
7676

77+
const _PyGC_PREV_SHIFT: usize = 2;
78+
pub const _PyObject_MIN_ALIGNMENT: usize = 1 << _PyGC_PREV_SHIFT;
79+
7780
// PyObject_HEAD_INIT comes before the PyObject definition in object.h
7881
// but we put it after PyObject because HEAD_INIT uses PyObject
7982

@@ -114,7 +117,9 @@ pub const PyObject_HEAD_INIT: PyObject = PyObject {
114117
_ob_next: std::ptr::null_mut(),
115118
#[cfg(py_sys_config = "Py_TRACE_REFS")]
116119
_ob_prev: std::ptr::null_mut(),
117-
#[cfg(Py_GIL_DISABLED)]
120+
#[cfg(all(Py_GIL_DISABLED, not(Py_3_15)))]
121+
ob_tid: 0,
122+
#[cfg(all(Py_GIL_DISABLED, Py_3_15))]
118123
ob_tid: 0,
119124
#[cfg(all(Py_GIL_DISABLED, Py_3_14))]
120125
ob_flags: 0,

pyo3-ffi/src/refcount.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ use std::ptr;
1414
#[cfg(Py_GIL_DISABLED)]
1515
use std::sync::atomic::Ordering::Relaxed;
1616

17-
#[cfg(Py_3_14)]
17+
#[cfg(all(Py_3_14, not(Py_3_15)))]
1818
const _Py_STATICALLY_ALLOCATED_FLAG: c_int = 1 << 7;
19+
#[cfg(Py_3_15)]
20+
const _Py_STATICALLY_ALLOCATED_FLAG: c_int = 1 << 2;
1921

2022
#[cfg(all(Py_3_12, not(Py_3_14)))]
2123
const _Py_IMMORTAL_REFCNT: Py_ssize_t = {

0 commit comments

Comments
 (0)