cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Error handling for some instructions is incorrect

Open brandtbucher opened this issue 2 years ago • 0 comments

In several places, we have goto error; branches in bytecode instructions that occur after modifying the next_instr pointer. This is incorrect, since the error branch will behave as if the error occurred in the new location (most often an adjacent instruction). The result could be as benign as an incorrect location in a traceback, or as problematic as incorrect control flow in or near a try/except block.

I tried for a bit to make the compiler emit code that did the wrong thing here, and I wasn't able to. So this is mostly a theoretical concern (but still worth fixing).

  • PR: gh-99299
  • PR: gh-99343

brandtbucher avatar Nov 09 '22 20:11 brandtbucher