Closed
Description
_PyFrame_GetState is a static function so can be renamed to reflect that.
More importantly, it calculates a lot more than what it is actually used for (it is called in two places, each of which checks for one of the states: CLEARED or SUSPENDED). The rest is neither used nor tested.
Some of the other states that this function checks for depend on the opcode at prev_instr
, which is going to be replaced soon by instr_ptr
. If we want to keep this function working we need to first cover all the states by tests. But there is no point doing this for code which is unused.
So I will replace this function by two simpler functions for the two existing use cases: checking if the frame is in CLEARED or SUSPENDED state.