mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-31 07:38:04 +00:00
Merge pull request #4174 from jopemachine/fix-dis
Always insert `None` at `code_stack.constants`
This commit is contained in:
commit
438c73732e
1 changed files with 9 additions and 0 deletions
|
@ -1107,6 +1107,10 @@ impl Compiler {
|
|||
|
||||
let (doc_str, body) = split_doc(body);
|
||||
|
||||
self.current_codeinfo()
|
||||
.constants
|
||||
.insert_full(ConstantData::None);
|
||||
|
||||
self.compile_statements(body)?;
|
||||
|
||||
// Emit None at end:
|
||||
|
@ -2122,6 +2126,11 @@ impl Compiler {
|
|||
|
||||
let name = "<lambda>".to_owned();
|
||||
let mut funcflags = self.enter_function(&name, args)?;
|
||||
|
||||
self.current_codeinfo()
|
||||
.constants
|
||||
.insert_full(ConstantData::None);
|
||||
|
||||
self.compile_expression(body)?;
|
||||
self.emit(Instruction::ReturnValue);
|
||||
let code = self.pop_code_object();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue