GH-97002: Prevent `_PyInterpreterFrame`s from backing more than one `PyFrameObject` by brandtbucher · Pull Request #97996 · python/cpython
There is a nasty situation where a GC collection during PyFrameObject allocation could create multiple PyFrameObjects for the same _PyInterpreterFrame, which breaks our ownership rules and creates all sorts of opportunities for accessing corrupted memory.
If this happens, we just keep the PyFrameObject that has already been exposed to user code, and throw away the duplicate.