mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-08 05:35:22 +00:00
Fix panic on import statement with levels but no module name.
This commit is contained in:
parent
69c4d0b240
commit
91b43d47fb
1 changed files with 3 additions and 3 deletions
|
@ -271,7 +271,7 @@ impl Compiler {
|
|||
// import a, b, c as d
|
||||
for name in names {
|
||||
self.emit(Instruction::Import {
|
||||
name: name.symbol.clone(),
|
||||
name: Some(name.symbol.clone()),
|
||||
symbols: vec![],
|
||||
level: 0,
|
||||
});
|
||||
|
@ -293,7 +293,7 @@ impl Compiler {
|
|||
if import_star {
|
||||
// from .... import *
|
||||
self.emit(Instruction::ImportStar {
|
||||
name: module.clone().unwrap(),
|
||||
name: module.clone(),
|
||||
level: *level,
|
||||
});
|
||||
} else {
|
||||
|
@ -303,7 +303,7 @@ impl Compiler {
|
|||
|
||||
// Load module once:
|
||||
self.emit(Instruction::Import {
|
||||
name: module.clone().unwrap(),
|
||||
name: module.clone(),
|
||||
symbols: from_list,
|
||||
level: *level,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue