[mypyc] Make list get/set item more memory safe on free-threaded builds (#21683)
Use the CPython C API for list get item and set item, as direct item access is not memory safe in the presence of race conditions on a free-threaded Python. Note that these operations are not necessarily atomic -- this only fixes memory safety. Explicit synchronization is still generally expected for correctness. This still doesn't cover for loops over lists. I will fix them in a follow-up PR. Preserve existing optimized primitives on non-free-threaded builds. Work on mypyc/mypyc#1202.
J
Jukka Lehtosalo committed
cd747e557aaf5d96983e32dc69ebf84d6dfc99de
Parent: 0f95654
Committed by GitHub <noreply@github.com>
on 7/6/2026, 4:02:09 PM