[3.13] gh-146227: Fix wrong type in _Py_atomic_load_uint16 in pyatomic_std.h (gh-146229) (#146233)

Also fix a related issue in the pyatomic headers:

* Fix pseudo-code comment for _Py_atomic_store_ptr_release in
  pyatomic.h.

(cherry picked from commit 1eff27f2c0)
This commit is contained in:
Sam Gross 2026-03-20 16:08:29 -04:00 committed by GitHub
parent cfd7f94c12
commit fa2f9a3bf8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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.