Commit e8a9ab94 authored by Stefan Behnel's avatar Stefan Behnel

Fix nogil status for error handling in line tracing code of with/try-finally statements.

See #2879.
parent d6341966
...@@ -7539,12 +7539,14 @@ class TryFinallyStatNode(StatNode): ...@@ -7539,12 +7539,14 @@ class TryFinallyStatNode(StatNode):
code.funcstate.in_try_finally = was_in_try_finally code.funcstate.in_try_finally = was_in_try_finally
code.putln("}") code.putln("}")
code.set_all_labels(old_labels)
temps_to_clean_up = code.funcstate.all_free_managed_temps() temps_to_clean_up = code.funcstate.all_free_managed_temps()
code.mark_pos(self.finally_clause.pos) code.mark_pos(self.finally_clause.pos)
code.putln("/*finally:*/ {") code.putln("/*finally:*/ {")
# Reset labels only after writing out a potential line trace call for correct nogil error handling.
code.set_all_labels(old_labels)
def fresh_finally_clause(_next=[self.finally_clause]): def fresh_finally_clause(_next=[self.finally_clause]):
# generate the original subtree once and always keep a fresh copy # generate the original subtree once and always keep a fresh copy
node = _next[0] node = _next[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment