mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Fix LoadNameAny opecode
This commit is contained in:
@@ -538,11 +538,14 @@ impl ExecutingFrame<'_> {
|
||||
}
|
||||
bytecode::Instruction::LoadNameAny(idx) => {
|
||||
let name = self.code.names[*idx as usize];
|
||||
let value = self.locals.mapping().subscript(name, vm).ok();
|
||||
self.push_value(match value {
|
||||
Some(x) => x,
|
||||
None => self.load_global_or_builtin(name, vm)?,
|
||||
});
|
||||
let result = self.locals.mapping().subscript(name, vm);
|
||||
match result {
|
||||
Ok(x) => self.push_value(x),
|
||||
Err(e) if e.class().is(vm.ctx.exceptions.key_error) => {
|
||||
self.push_value(self.load_global_or_builtin(name, vm)?);
|
||||
}
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
bytecode::Instruction::LoadGlobal(idx) => {
|
||||
|
||||
Reference in New Issue
Block a user