First, try to remove all .pyc
files (and .pyo
if any), and restarting the server. If it doesn't help, please report the issue to http://bugs.python.org/ --- it really looks like a Python bug. The only way I can think of getting this would be by using obscure trickery like generating custom bytecode sequences.
If you cannot post a way for us to reproduce the problem, you can also try to edit Objects/frameobject.c in the Python source code, in PyFrame_BlockPop(), to display more information before the crash. At least _PyObject_Dump(f); _PyObject_Dump(f->f_code);
would be useful in locating where the error is.