mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-115999: Specialize LOAD_SUPER_ATTR
in free-threaded builds (gh-127128)
Use existing helpers to atomically modify the bytecode. Add unit tests to ensure specializing is happening as expected. Add test_specialize.py that can be used with ThreadSanitizer to detect data races. Fix thread safety issue with cell_set_contents().
This commit is contained in:
parent
8ba9f5bca9
commit
0cb5222079
6 changed files with 51 additions and 21 deletions
|
@ -145,8 +145,9 @@ cell_get_contents(PyObject *self, void *closure)
|
|||
static int
|
||||
cell_set_contents(PyObject *self, PyObject *obj, void *Py_UNUSED(ignored))
|
||||
{
|
||||
PyCellObject *op = _PyCell_CAST(self);
|
||||
Py_XSETREF(op->ob_ref, Py_XNewRef(obj));
|
||||
PyCellObject *cell = _PyCell_CAST(self);
|
||||
Py_XINCREF(obj);
|
||||
PyCell_SetTakeRef((PyCellObject *)cell, obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue