Skip to content

Commit d0c827e

Browse files
authored
Merge pull request RustPython#5184 from youknowone/symboltable
better symboltable error message
2 parents e6c6f96 + d26766b commit d0c827e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/codegen/src/compile.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,8 @@ impl Compiler {
478478
self.check_forbidden_name(&name, usage)?;
479479

480480
let symbol_table = self.symbol_table_stack.last().unwrap();
481-
let symbol = symbol_table.lookup(name.as_ref()).expect(
482-
"The symbol must be present in the symbol table, even when it is undefined in python.",
481+
let symbol = symbol_table.lookup(name.as_ref()).unwrap_or_else(||
482+
panic!("The symbol '{name}' must be present in the symbol table, even when it is undefined in python."),
483483
);
484484
let info = self.code_stack.last_mut().unwrap();
485485
let mut cache = &mut info.name_cache;

0 commit comments

Comments
 (0)