mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Implement execution of finally block. Fixes #1306.
This commit is contained in:
1 parent
86fc18ec6c
commit
2ca6e5d399
4 files changed
+94
-40
No files matched your search
@@ -187,11 +187,15 @@ pub enum Instruction {
|
||||
handler: Label,
|
||||
},
|
||||
|
||||
/// Enter a finally block, without returning, excepting, just because we are there.
|
||||
EnterFinally,
|
||||
|
||||
/// Marker bytecode for the end of a finally sequence.
|
||||
/// When this bytecode is executed, the eval loop does one of those things:
|
||||
/// - Continue at a certain bytecode position
|
||||
/// - Propagate the exception
|
||||
/// - Return from a function
|
||||
/// - Do nothing at all, just continue
|
||||
EndFinally,
|
||||
|
||||
SetupExcept {
|
||||
@@ -493,6 +497,7 @@ impl Instruction {
|
||||
SetupLoop { start, end } => w!(SetupLoop, label_map[start], label_map[end]),
|
||||
SetupExcept { handler } => w!(SetupExcept, label_map[handler]),
|
||||
SetupFinally { handler } => w!(SetupFinally, label_map[handler]),
|
||||
EnterFinally => w!(EnterFinally),
|
||||
EndFinally => w!(EndFinally),
|
||||
SetupWith { end } => w!(SetupWith, end),
|
||||
CleanupWith { end } => w!(CleanupWith, end),
|
||||
|
||||
Reference in new issue
Block a user