mirror of
https://github.com/RustPython/Parser.git
synced 2025-09-02 00:28:39 +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)?,
|
Name { id, .. } => self.load_name(id)?,
|
||||||
Lambda { args, body } => {
|
Lambda { args, body } => {
|
||||||
let prev_ctx = self.ctx;
|
let prev_ctx = self.ctx;
|
||||||
|
|
||||||
|
let name = "<lambda>".to_owned();
|
||||||
|
let mut funcflags = self.enter_function(&name, args)?;
|
||||||
|
|
||||||
self.ctx = CompileContext {
|
self.ctx = CompileContext {
|
||||||
loop_data: Option::None,
|
loop_data: Option::None,
|
||||||
in_class: prev_ctx.in_class,
|
in_class: prev_ctx.in_class,
|
||||||
func: FunctionContext::Function,
|
func: FunctionContext::Function,
|
||||||
};
|
};
|
||||||
|
|
||||||
let name = "<lambda>".to_owned();
|
|
||||||
let mut funcflags = self.enter_function(&name, args)?;
|
|
||||||
|
|
||||||
self.current_codeinfo()
|
self.current_codeinfo()
|
||||||
.constants
|
.constants
|
||||||
.insert_full(ConstantData::None);
|
.insert_full(ConstantData::None);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue