There are two places in frameobject.c where there is a check like:
if (PyCell_Check(value) && _PyFrame_OpAlreadyRan(f, MAKE_CELL, i))
(added by @ericsnowcurrently in python/cpython@631f993).
No tests fail if I replace _PyFrame_OpAlreadyRan(...) by true, and preceded by
if (PyCell_Check(value)) {
assert(_PyFrame_OpAlreadyRan(frame, MAKE_CELL, i));
}
From inspecting the code, there are only two places where a PyCell can be created: in MAKE_CELL, and from Python via types.CellType(). Is the check intended to catch cells created from Python in this way? If so, can be write a test for it? Otherwise, can we just check PyCell_Check(value) and remove the _PyFrame_OpAlreadyRan function?