# HG changeset patch # User da-woods <dw-git@d-woods.co.uk> # Date 1593442460 -3600 # Mon Jun 29 15:54:20 2020 +0100 # Node ID b1c559a8ff8e55e5fa94a7c45d8860d876572bb7 # Parent ece07b0818941a7472a06c7889c4b91cae53fb36 Fix argument name usage in finally blocks (GH-3713) Fixes #3712 (hopefully) by reverting a small part of bbef4d7 diff --git a/Cython/Compiler/FlowControl.py b/Cython/Compiler/FlowControl.py --- a/Cython/Compiler/FlowControl.py +++ b/Cython/Compiler/FlowControl.py @@ -1198,6 +1198,7 @@ if self.flow.loops: self.flow.loops[-1].exceptions.append(descr) self.flow.block = body_block + body_block.add_child(entry_point) self.flow.nextblock() self._visit(node.body) self.flow.exceptions.pop() diff --git a/tests/compile/tryfinally.pyx b/tests/compile/tryfinally.pyx --- a/tests/compile/tryfinally.pyx +++ b/tests/compile/tryfinally.pyx @@ -18,4 +18,11 @@ finally: i = 42 +def use_name_in_finally(name): + # GH3712 + try: + [] + finally: + name() +