fix: avoid popping defblock and segfault

This commit is contained in:
2025-03-07 15:36:03 +08:00
parent 93c9e47e82
commit e4f96df166

View File

@@ -1722,6 +1722,13 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
mod->verCompare(3, 11) >= 0 ? code->qualName()->value() : code->name()->value()); mod->verCompare(3, 11) >= 0 ? code->qualName()->value() : code->name()->value());
} }
} }
// BEGIN ONESHOT TEMPORARY PATCH
// The problem is not here, but in the way the blocks are created
// Add this to avoid segfault
if (blocks.top() == defblock)
break;
// END ONESHOT PATCH
PycRef<ASTBlock> tmp = curblock; PycRef<ASTBlock> tmp = curblock;
blocks.pop(); blocks.pop();