]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-146227: Fix wrong type in _Py_atomic_load_uint16 in pyatomic_std.h (gh...
authorSam Gross <colesbury@gmail.com>
Fri, 20 Mar 2026 20:08:29 +0000 (16:08 -0400)
committerGitHub <noreply@github.com>
Fri, 20 Mar 2026 20:08:29 +0000 (20:08 +0000)
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 1eff27f2c0452b3114bcf139062c87c025842c3e)

Include/cpython/pyatomic.h
Include/cpython/pyatomic_std.h
Misc/NEWS.d/next/Core_and_Builtins/2026-03-20-13-07-33.gh-issue-146227.MqBPEo.rst [new file with mode: 0644]

index 28029859d3df2b826c27812fc845ba3016b884c0..71e91c8964b98139a40cf533f1e986ae75172d24 100644 (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
index 7c71e94c68f8e6d16664201bd71f8538c10d361d..ab3a4e1c74cd6422f753fee70f0e7f6d48ff5c8a 100644 (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
diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-03-20-13-07-33.gh-issue-146227.MqBPEo.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-03-20-13-07-33.gh-issue-146227.MqBPEo.rst
new file mode 100644 (file)
index 0000000..11e19eb
--- /dev/null
@@ -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.