This commit is contained in:
blueloveTH 2024-05-26 13:33:23 +08:00
parent 1de9c1f639
commit 8f34024833
2 changed files with 12 additions and 2 deletions

View File

@ -47,7 +47,9 @@ namespace pkpy{
// pop possible stack memory slots
if(_s->top().type == kTpStackMemoryIndex){
int count = _s->top().as<StackMemory>().count;
_s->_sp -= (count + 2);
PK_DEBUG_ASSERT(count < 0);
_s->_sp += count;
_s->_sp -= 2; // pop header and tail
}
}else if(type==CodeBlockType::CONTEXT_MANAGER){
_s->pop();

View File

@ -1,3 +1,11 @@
# multi loop bug
out = []
a = [1, 2]
for i in a:
for j in a:
out.append((i, j))
assert (out == [(1, 1), (1, 2), (2, 1), (2, 2)]), out
# https://github.com/pocketpy/pocketpy/issues/37
mp = map(lambda x: x**2, [1, 2, 3, 4, 5] )