forked from Rust-related/RustPython
better symboltable error message
This commit is contained in:
@@ -478,8 +478,8 @@ impl Compiler {
|
||||
self.check_forbidden_name(&name, usage)?;
|
||||
|
||||
let symbol_table = self.symbol_table_stack.last().unwrap();
|
||||
let symbol = symbol_table.lookup(name.as_ref()).expect(
|
||||
"The symbol must be present in the symbol table, even when it is undefined in python.",
|
||||
let symbol = symbol_table.lookup(name.as_ref()).unwrap_or_else(||
|
||||
panic!("The symbol '{name}' must be present in the symbol table, even when it is undefined in python."),
|
||||
);
|
||||
let info = self.code_stack.last_mut().unwrap();
|
||||
let mut cache = &mut info.name_cache;
|
||||
|
||||
Reference in New Issue
Block a user