diff --git a/ASTree.cpp b/ASTree.cpp index 108e4e4a7..8fff71b66 100644 --- a/ASTree.cpp +++ b/ASTree.cpp @@ -1306,6 +1306,12 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) stack_hist.pop(); } + if (blocks.size() == 1 && !source.atEof()) { + fprintf(stderr, "Warning: Refusing to pop last block when there is more code to parse pos: %d OP: %02x\n", pos, opcode & 0xff); + cleanBuild = false; + break; + } + PycRef prev = curblock; PycRef nil; bool push = true; @@ -1589,6 +1595,12 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) curblock->removeLast(); } + if (blocks.size() == 1 && !source.atEof()) { + fprintf(stderr, "Warning: Refusing to pop last block when there is more code to parse pos: %d OP: %02x\n", pos, opcode & 0xff); + cleanBuild = false; + break; + } + if (curblock->blktype() == ASTBlock::BLK_IF || curblock->blktype() == ASTBlock::BLK_ELIF || curblock->blktype() == ASTBlock::BLK_ELSE