It looks like the changes for bug
#5000 Changin EditMode in Script wrecks memory
break the python interpreter.
Since this is critical, I have #ifdef'ed those out of
BPY_interface.c and Window.c. Did not touch Armature.c.
The ifdefs are tagged with /* bug 5000 */
This means bug #5000 is back in play. Interesting to note
that according to #5846, only scripts run from the script menu
and not via Alt-P were broken.