Skip to content

Commit 9d1b11f

Browse files
adamreicholddavidhewitt
authored andcommitted
Use portable-atomic for targets which lack 64-bit atomics used to check interpreter ID.
I chose to make the dependency mandatory instead of optional as portable-atomic itself just forwards to the native atomics when they are available so making that choice part of our build system is not really necessary. Personally, I was unable to perceive any noticeable compile-time hit from adding it.
1 parent 4774ded commit 9d1b11f

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ cfg-if = "1.0"
1919
libc = "0.2.62"
2020
parking_lot = ">= 0.11, < 0.13"
2121
memoffset = "0.9"
22+
portable-atomic = "1.0"
2223

2324
# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
2425
pyo3-ffi = { path = "pyo3-ffi", version = "=0.20.2" }

newsfragments/3619.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use portable-atomic to support platforms without 64-bit atomics

src/impl_/pymodule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::cell::UnsafeCell;
44

55
#[cfg(all(not(PyPy), Py_3_9, not(all(windows, Py_LIMITED_API, not(Py_3_10)))))]
6-
use std::sync::atomic::{AtomicI64, Ordering};
6+
use portable_atomic::{AtomicI64, Ordering};
77

88
#[cfg(not(PyPy))]
99
use crate::exceptions::PyImportError;

0 commit comments

Comments
 (0)