Skip to content

Commit 898e2e8

Browse files
authored
DateTime: use more relaxed ordering constraints (#6027)
Follow up to #6026
1 parent c37c2a7 commit 898e2e8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pyo3-ffi/src/datetime.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,12 +604,12 @@ pub const PyDateTime_CAPSULE_NAME: &CStr = c"datetime.datetime_CAPI";
604604
/// `PyDateTime_IMPORT` is called
605605
#[inline]
606606
pub unsafe fn PyDateTimeAPI() -> *mut PyDateTime_CAPI {
607-
PyDateTimeAPI_impl.load(core::sync::atomic::Ordering::SeqCst)
607+
PyDateTimeAPI_impl.load(Ordering::Acquire)
608608
}
609609

610610
/// Populates the `PyDateTimeAPI` object
611611
pub unsafe fn PyDateTime_IMPORT() {
612-
if PyDateTimeAPI_impl.load(Ordering::SeqCst).is_null() {
612+
if PyDateTimeAPI_impl.load(Ordering::Relaxed).is_null() {
613613
// PyPy expects the C-API to be initialized via PyDateTime_Import, so trying to use
614614
// `PyCapsule_Import` will behave unexpectedly in pypy.
615615
#[cfg(PyPy)]
@@ -628,8 +628,8 @@ pub unsafe fn PyDateTime_IMPORT() {
628628
let _ = PyDateTimeAPI_impl.compare_exchange(
629629
ptr::null_mut(),
630630
py_datetime_c_api,
631-
Ordering::SeqCst,
632-
Ordering::SeqCst,
631+
Ordering::Release,
632+
Ordering::Relaxed,
633633
);
634634
}
635635
}

0 commit comments

Comments
 (0)