Fix bad pop on bare except-finally
This commit is contained in:
parent
dec38c410c
commit
2d3e7ca3d3
@ -1820,6 +1820,7 @@ _anotherExcept:
|
||||
emitByte(OP_BEGIN_FINALLY);
|
||||
exitJumps = 0;
|
||||
if (nextJump != -1) {
|
||||
emitByte(OP_NONE);
|
||||
patchJump(nextJump);
|
||||
emitByte(OP_POP);
|
||||
}
|
||||
|
18
test/testBareFinally.krk
Normal file
18
test/testBareFinally.krk
Normal file
@ -0,0 +1,18 @@
|
||||
try:
|
||||
raise ValueError()
|
||||
except ValueError as e:
|
||||
print(repr(e))
|
||||
finally:
|
||||
print("Done?")
|
||||
|
||||
try:
|
||||
print("try")
|
||||
finally:
|
||||
print('finally')
|
||||
|
||||
try:
|
||||
print('try')
|
||||
except Exception as e:
|
||||
print('except')
|
||||
finally:
|
||||
print('finally')
|
6
test/testBareFinally.krk.expect
Normal file
6
test/testBareFinally.krk.expect
Normal file
@ -0,0 +1,6 @@
|
||||
ValueError(None)
|
||||
Done?
|
||||
try
|
||||
finally
|
||||
try
|
||||
finally
|
Loading…
Reference in New Issue
Block a user