mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-16 01:25:25 +00:00
Merge pull request #4226 from jopemachine/fix-class-static
Fix lambda expression's unexpected `UnboundLocalError`
This commit is contained in:
commit
3768647eb0
1 changed files with 4 additions and 3 deletions
|
@ -2118,15 +2118,16 @@ impl Compiler {
|
|||
Name { id, .. } => self.load_name(id)?,
|
||||
Lambda { args, body } => {
|
||||
let prev_ctx = self.ctx;
|
||||
|
||||
let name = "<lambda>".to_owned();
|
||||
let mut funcflags = self.enter_function(&name, args)?;
|
||||
|
||||
self.ctx = CompileContext {
|
||||
loop_data: Option::None,
|
||||
in_class: prev_ctx.in_class,
|
||||
func: FunctionContext::Function,
|
||||
};
|
||||
|
||||
let name = "<lambda>".to_owned();
|
||||
let mut funcflags = self.enter_function(&name, args)?;
|
||||
|
||||
self.current_codeinfo()
|
||||
.constants
|
||||
.insert_full(ConstantData::None);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue