Bug report
Bug description:
Modification of type slots is protected by the global type lock, however, type slots are read non-atomically without holding the type lock. For example, in PyObject_SetItem:
| if (m&&m->mp_ass_subscript) { |
| intres=m->mp_ass_subscript(o, key, value); |
| assert(_Py_CheckSlotResult(o, "__setitem__", res >= 0)); |
| returnres; |
| } |
It's not clear how we want to address this. From @colesbury in #127169 (comment):
I'd lean towards doing a stop-the-world pause when modifying the slot so that we don't need to change every read. I expect that to be a bit tricky since class definitions look like they're mutating the class.
CPython versions tested on:
3.13, 3.14, CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
Modification of type slots is protected by the global type lock, however, type slots are read non-atomically without holding the type lock. For example, in
PyObject_SetItem:cpython/Objects/abstract.c
Lines 231 to 235 in 5bb059f
It's not clear how we want to address this. From @colesbury in #127169 (comment):
CPython versions tested on:
3.13, 3.14, CPython main branch
Operating systems tested on:
Linux
Linked PRs