mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Fix weird yield from interpreter bug
This commit is contained in:
@@ -32,10 +32,11 @@ def g3():
|
||||
yield 23
|
||||
yield from make_numbers()
|
||||
yield 44
|
||||
yield from make_numbers()
|
||||
|
||||
r = list(g3())
|
||||
# print(r)
|
||||
assert r == [23, 1, 2, 3, 44]
|
||||
assert r == [23, 1, 2, 3, 44, 1, 2, 3]
|
||||
|
||||
def g4():
|
||||
yield
|
||||
|
||||
@@ -372,11 +372,7 @@ impl Frame {
|
||||
*self.lasti.borrow_mut() -= 1;
|
||||
Ok(Some(ExecutionResult::Yield(value)))
|
||||
}
|
||||
None => {
|
||||
// Pop iterator from stack:
|
||||
self.pop_value();
|
||||
Ok(None)
|
||||
}
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
bytecode::Instruction::SetupLoop { start, end } => {
|
||||
@@ -1173,7 +1169,10 @@ impl Frame {
|
||||
}
|
||||
|
||||
fn pop_value(&self) -> PyObjectRef {
|
||||
self.stack.borrow_mut().pop().unwrap()
|
||||
self.stack
|
||||
.borrow_mut()
|
||||
.pop()
|
||||
.expect("Tried to pop value but there was nothing on the stack")
|
||||
}
|
||||
|
||||
fn pop_multiple(&self, count: usize) -> Vec<PyObjectRef> {
|
||||
|
||||
Reference in New Issue
Block a user