We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b1db1be commit 03eb2ddCopy full SHA for 03eb2dd
vm/src/frame.rs
@@ -538,11 +538,14 @@ impl ExecutingFrame<'_> {
538
}
539
bytecode::Instruction::LoadNameAny(idx) => {
540
let name = self.code.names[*idx as usize];
541
- let value = self.locals.mapping().subscript(name, vm).ok();
542
- self.push_value(match value {
543
- Some(x) => x,
544
- None => self.load_global_or_builtin(name, vm)?,
545
- });
+ 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)?);
546
+ }
547
+ Err(e) => return Err(e),
548
549
Ok(None)
550
551
bytecode::Instruction::LoadGlobal(idx) => {
0 commit comments