Exec() with 'return' keyword

Well it could be done, maybe starting anywhere will not fix the problem. When doing live-patching, it is common to remove certain lines of buggy code and insert bug-free code on-the-fly, and it is possible to go back to certain line and execute the following code. In general it involves skipping, deleting, going back and insertion. In the process you know where your code is at, and what code will be run next. It’s like a Turing machine with human intervention. The states may or may not be restored, depending on the situation and implementation. Even if without previous state restored, one can fix the situation with handwritten code by looking into the current state. If you think certain following lines will cause trouble you can remove or skip them, without the need for machine to run and raise exceptions for you.

I’m not saying this is for everyone. This is just how I would use it to debug my programs. Python is a scripting language, which makes it easier to do such things.

Live patching can also be persistent, modifying the running code and the code on disk at the same time, commenting out the buggy code.