-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
_Py_atomic_load_uint16 incorrect in pyatomic_std.h #146227
Copy link
Copy link
Closed
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixestopic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixestopic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Bug report
Found by Mohammed Zuhaib in https://discuss.python.org/t/code-explanation-for-absence-of-stdatomic-h-for-python-build/101623/30.
cpython/Include/cpython/pyatomic_std.h
Lines 458 to 463 in 6450b1d
We cast to a
uint32_tinstead ofuint16_t. I suspect this probably doesn't have noticeable effects on little-endian systems, but would load the wrong value on big-endian systems. We also mostly usepyatomic_gcc.horpyatomic_msvc.h, which is probably why we didn't catch this in big-endian buildbots.I asked Claude to review these files. In addition to the above bug:
Linked PRs