Some debugging helper code and my conclutions of one work day:
debughelper.tgZ:
-test_broken1/2.py
one does triggers the bug, the other doesn't)
-rtest.sh
executes boths and compares its outputs
-frameobject.c.diff
applied to Objects/frameobject.c, adds some debug info.
What I found:
1. The CustomException is disappearing from locals()
2. PyFrame_FastToLocals() (from that .c file) is updating the locals,
and removing that exception from there.
3. In the failing case this code:
if (deref) {
assert(PyCell_Check(value));
value = PyCell_GET(value);
}
is returning value==NULL.
Don't know why that happens.
But you could inspect out1.txt/out2.txt made with rtest.sh, and could
discover something..