Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
fc136a21
Commit
fc136a21
authored
Dec 18, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix try-finally-return in functions returning void
parent
57eeea18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-2
No files found.
Cython/Compiler/Nodes.py
View file @
fc136a21
...
@@ -6328,6 +6328,7 @@ class TryFinallyStatNode(StatNode):
...
@@ -6328,6 +6328,7 @@ class TryFinallyStatNode(StatNode):
# handle exception case, in addition to return/break/continue
# handle exception case, in addition to return/break/continue
handle_error_case
=
True
handle_error_case
=
True
func_return_type
=
None
disallow_continue_in_try_finally
=
0
disallow_continue_in_try_finally
=
0
# There doesn't seem to be any point in disallowing
# There doesn't seem to be any point in disallowing
...
@@ -6349,6 +6350,8 @@ class TryFinallyStatNode(StatNode):
...
@@ -6349,6 +6350,8 @@ class TryFinallyStatNode(StatNode):
self
.
body
=
self
.
body
.
analyse_expressions
(
env
)
self
.
body
=
self
.
body
.
analyse_expressions
(
env
)
self
.
finally_clause
=
self
.
finally_clause
.
analyse_expressions
(
env
)
self
.
finally_clause
=
self
.
finally_clause
.
analyse_expressions
(
env
)
self
.
func_return_type
=
env
.
return_type
self
.
func_return_type
=
env
.
return_type
if
self
.
func_return_type
and
self
.
func_return_type
.
is_void
:
self
.
func_return_type
=
None
return
self
return
self
nogil_check
=
Node
.
gil_error
nogil_check
=
Node
.
gil_error
...
@@ -6462,8 +6465,6 @@ class TryFinallyStatNode(StatNode):
...
@@ -6462,8 +6465,6 @@ class TryFinallyStatNode(StatNode):
if
old_label
==
return_label
and
not
self
.
finally_clause
.
is_terminator
:
if
old_label
==
return_label
and
not
self
.
finally_clause
.
is_terminator
:
# store away return value for later reuse
# store away return value for later reuse
if
self
.
func_return_type
:
if
self
.
func_return_type
:
# pure safety check, func_return_type should
# always be set when return label is used
ret_temp
=
code
.
funcstate
.
allocate_temp
(
ret_temp
=
code
.
funcstate
.
allocate_temp
(
self
.
func_return_type
,
manage_ref
=
False
)
self
.
func_return_type
,
manage_ref
=
False
)
code
.
putln
(
"%s = %s;"
%
(
ret_temp
,
Naming
.
retval_cname
))
code
.
putln
(
"%s = %s;"
%
(
ret_temp
,
Naming
.
retval_cname
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment