Fix for if 1 in 2.3.

I remain ever so midly concerned that this shouldn't exist at all.
This commit is contained in:
Darryl Pogue
2011-10-22 01:33:18 -07:00
parent 1975139843
commit 735788c54f

View File

@@ -1034,8 +1034,10 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
break;
}
if (curblock->blktype() == ASTBlock::BLK_WHILE
&& !curblock->inited()) {
if ((curblock->blktype() == ASTBlock::BLK_WHILE
&& !curblock->inited())
|| (curblock->blktype() == ASTBlock::BLK_IF
&& curblock->size() == 0)) {
PycRef<PycObject> fakeint = new PycInt(1);
PycRef<ASTNode> truthy = new ASTObject(fakeint);
@@ -1094,6 +1096,11 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
stack_hist.pop();
}
push = false;
if (prev->blktype() == ASTBlock::BLK_MAIN) {
/* Something went out of control! */
prev = nil;
}
} else if (prev->blktype() == ASTBlock::BLK_TRY
&& prev->end() < pos+operand) {
/* Need to add an except/finally block */