Skip to content

Commit 0ab4fe4

Browse files
authored
pop top frame from stack if we throw evaluating it (#111)
* pop top frame from stack if we error evaluating it * add breakpoint test
1 parent 95e8a6e commit 0ab4fe4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/interpret.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,12 @@ function evaluate_call!(stack, frame::JuliaStackFrame, call_expr::Expr, pc; exec
212212
push!(stack, newframe)
213213
return BreakpointRef(newframe.code, newframe.pc[])
214214
end
215-
ret = exec!(stack, newframe)
215+
ret = try
216+
exec!(stack, newframe)
217+
catch e
218+
pop!(stack)
219+
rethrow(e)
220+
end
216221
isa(ret, BreakpointRef) && return ret
217222
pop!(stack)
218223
push!(junk, newframe) # rather than going through GC, just re-use it

test/breakpoints.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ end
118118
frame = JuliaInterpreter.enter_call(f_exc_outer);
119119
v = JuliaInterpreter.finish_and_return!(stack, frame)
120120
@test v isa ErrorException
121+
@test isempty(stack)
121122
finally
122123
JuliaInterpreter.break_on_error[] = false
123124
end

0 commit comments

Comments
 (0)