Skip to content

Commit

Permalink
Move the ThreadChecker field in front of dict and weakref.
Browse files Browse the repository at this point in the history
Offsets for dict and weakref are calculated from the end of the
PyCell struct. When using the non-dummy ThreadChecker, the offsets
were invalid since the `ThreadCheckerImpl` is not zero-sized.
  • Loading branch information
sebpuetz committed Jul 20, 2020
1 parent 53a248c commit e63f652
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pycell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ impl<T: PyClass> PyCellInner<T> {
#[repr(C)]
pub struct PyCell<T: PyClass> {
inner: PyCellInner<T>,
thread_checker: T::ThreadChecker,
dict: T::Dict,
weakref: T::WeakRef,
thread_checker: T::ThreadChecker,
}

unsafe impl<T: PyClass> PyNativeType for PyCell<T> {}
Expand Down

0 comments on commit e63f652

Please sign in to comment.