Skip to content

Commit

Permalink
make the _bits field of PyMutex pub(crate)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoldbaum committed Aug 14, 2024
1 parent 848c793 commit 4f261c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyo3-ffi/src/cpython/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::atomic::AtomicU8;

#[repr(C)]
pub struct PyMutex {
_bits: AtomicU8,
pub(crate) _bits: AtomicU8,
}

impl fmt::Debug for PyMutex {
Expand Down
6 changes: 4 additions & 2 deletions pyo3-ffi/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::mem;
use std::os::raw::{c_char, c_int, c_uint, c_ulong, c_void};
use std::ptr;
#[cfg(Py_GIL_DISABLED)]
use std::sync::atomic::{AtomicIsize, AtomicU32, Ordering::Relaxed};
use std::sync::atomic::{AtomicIsize, AtomicU32, AtomicU8, Ordering::Relaxed};

#[cfg(Py_LIMITED_API)]
opaque_struct!(PyTypeObject);
Expand Down Expand Up @@ -42,7 +42,9 @@ pub const fn PyObject_HEAD_INIT() -> PyObject {
#[cfg(Py_GIL_DISABLED)]
_padding: 0,
#[cfg(Py_GIL_DISABLED)]
ob_mutex: unsafe { mem::zeroed::<PyMutex>() },
ob_mutex: PyMutex {
_bits: AtomicU8::new(0),
},
#[cfg(Py_GIL_DISABLED)]
ob_gc_bits: 0,
#[cfg(Py_GIL_DISABLED)]
Expand Down

0 comments on commit 4f261c2

Please sign in to comment.