Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[3.13] gh-146227: Fix wrong type in _Py_atomic_load_uint16 in pyatomi…
…c_std.h (gh-146229)

Also fix a few related issues in the pyatomic headers:

* Fix _Py_atomic_store_uint_release in pyatomic_msc.h to use __stlr32
  on ARM64 instead of a plain volatile store (which is only relaxed on
  ARM64).

* Add missing _Py_atomic_store_uint_release to pyatomic_gcc.h.

* Fix pseudo-code comment for _Py_atomic_store_ptr_release in
  pyatomic.h.
(cherry picked from commit 1eff27f)

Co-authored-by: Sam Gross <colesbury@gmail.com>
  • Loading branch information
colesbury committed Mar 20, 2026
commit ff99aaab25525aafcb789e0f8b3bc569f14e982e
4 changes: 2 additions & 2 deletions Include/cpython/pyatomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
// def _Py_atomic_load_ptr_acquire(obj):
// return obj # acquire
//
// def _Py_atomic_store_ptr_release(obj):
// return obj # release
// def _Py_atomic_store_ptr_release(obj, value):
// obj = value # release
//
// def _Py_atomic_fence_seq_cst():
// # sequential consistency
Expand Down
2 changes: 1 addition & 1 deletion Include/cpython/pyatomic_std.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ static inline uint16_t
_Py_atomic_load_uint16(const uint16_t *obj)
{
_Py_USING_STD;
return atomic_load((const _Atomic(uint32_t)*)obj);
return atomic_load((const _Atomic(uint16_t)*)obj);
}

static inline uint32_t
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix wrong type in ``_Py_atomic_load_uint16`` in the C11 atomics backend
(``pyatomic_std.h``), which used a 32-bit atomic load instead of 16-bit.
Found by Mohammed Zuhaib.
Loading