# 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 f520493102bde61f09c72eeb41a40ddb0e41ca6a
# Parent  4bce8e0c8f54b84dcf5b835ecd1addf79643f62d
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
@@ -1220,6 +1220,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()
 
+