Actually, this is not quite correct in some corner cases (with the 5th patch). We can't reset the script dispatch because it may be externally held by something else (for example, by the TypeInfo). So please ignore for now.
But I need some help on how to proceed. The only way I can think of to solve this is to do something similar to the previous quirk, where we go through each code in the code_list -- and if they have a dangling context_obj, re-create a new context_obj dispatch for it.
But I understand that's a bit of an ugly quirk, so if you have a better idea, please let me know.
In short, what needs to happen is that persistent code should receive a fresh script dispatch when script is reinitialized. This already happens for the global dispatch, but unfortunately not for the context objects of named items.