Commit 47d75fe
committed
Fix data race in setiter_len() under no-gil
setiter_len() was reading so->used without atomic access while concurrent
mutations update it atomically under Py_GIL_DISABLED.
Use an atomic load for so->used to avoid a data race. This preserves the
existing semantics of __length_hint__ while making the access thread-safe.
Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>1 parent 96e4cd6 commit 47d75fe
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1056 | 1056 | | |
1057 | 1057 | | |
1058 | 1058 | | |
1059 | | - | |
| 1059 | + | |
| 1060 | + | |
1060 | 1061 | | |
1061 | 1062 | | |
1062 | 1063 | | |
| |||
0 commit comments