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
c1fa679b
Commit
c1fa679b
authored
Feb 26, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memleak in try-continue
parent
1b3b70ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+24
-2
No files found.
Cython/Compiler/Nodes.py
View file @
c1fa679b
...
...
@@ -4039,6 +4039,7 @@ class TryExceptStatNode(StatNode):
def
generate_execution_code
(
self
,
code
):
old_return_label
=
code
.
return_label
old_break_label
=
code
.
break_label
old_continue_label
=
code
.
continue_label
old_error_label
=
code
.
new_error_label
()
our_error_label
=
code
.
error_label
except_end_label
=
code
.
new_label
(
'exception_handled'
)
...
...
@@ -4046,6 +4047,7 @@ class TryExceptStatNode(StatNode):
except_return_label
=
code
.
new_label
(
'except_return'
)
try_return_label
=
code
.
new_label
(
'try_return'
)
try_break_label
=
code
.
new_label
(
'try_break'
)
try_continue_label
=
code
.
new_label
(
'try_continue'
)
try_end_label
=
code
.
new_label
(
'try_end'
)
code
.
putln
(
"{"
)
...
...
@@ -4059,6 +4061,7 @@ class TryExceptStatNode(StatNode):
"/*try:*/ {"
)
code
.
return_label
=
try_return_label
code
.
break_label
=
try_break_label
code
.
continue_label
=
try_continue_label
self
.
body
.
generate_execution_code
(
code
)
code
.
putln
(
"}"
)
...
...
@@ -4100,6 +4103,13 @@ class TryExceptStatNode(StatNode):
code
.
putln
(
"__Pyx_ExceptionReset(%s);"
%
', '
.
join
(
Naming
.
exc_save_vars
))
code
.
put_goto
(
old_break_label
)
if
code
.
label_used
(
try_continue_label
):
code
.
put_label
(
try_continue_label
)
for
var
in
Naming
.
exc_save_vars
:
code
.
put_xgiveref
(
var
)
code
.
putln
(
"__Pyx_ExceptionReset(%s);"
%
', '
.
join
(
Naming
.
exc_save_vars
))
code
.
put_goto
(
old_continue_label
)
if
code
.
label_used
(
except_return_label
):
code
.
put_label
(
except_return_label
)
...
...
@@ -4118,6 +4128,7 @@ class TryExceptStatNode(StatNode):
code
.
return_label
=
old_return_label
code
.
break_label
=
old_break_label
code
.
continue_label
=
old_continue_label
code
.
error_label
=
old_error_label
def
annotate
(
self
,
code
):
...
...
@@ -4219,10 +4230,13 @@ class ExceptClauseNode(Node):
self
.
excinfo_tuple
.
generate_evaluation_code
(
code
)
self
.
excinfo_target
.
generate_assignment_code
(
self
.
excinfo_tuple
,
code
)
old_break_label
,
old_continue_label
=
code
.
break_label
,
code
.
continue_label
code
.
break_label
=
code
.
new_label
(
'except_break'
)
code
.
continue_label
=
code
.
new_label
(
'except_continue'
)
old_exc_vars
=
code
.
funcstate
.
exc_vars
code
.
funcstate
.
exc_vars
=
self
.
exc_vars
old_break_label
=
code
.
break_label
code
.
break_label
=
code
.
new_label
(
'except_break'
)
self
.
body
.
generate_execution_code
(
code
)
code
.
funcstate
.
exc_vars
=
old_exc_vars
for
var
in
self
.
exc_vars
:
...
...
@@ -4235,6 +4249,14 @@ class ExceptClauseNode(Node):
code
.
putln
(
"__Pyx_DECREF(%s); %s = 0;"
%
(
var
,
var
))
code
.
put_goto
(
old_break_label
)
code
.
break_label
=
old_break_label
if
code
.
label_used
(
code
.
continue_label
):
code
.
put_label
(
code
.
continue_label
)
for
var
in
self
.
exc_vars
:
code
.
putln
(
"__Pyx_DECREF(%s); %s = 0;"
%
(
var
,
var
))
code
.
put_goto
(
old_continue_label
)
code
.
continue_label
=
old_continue_label
code
.
putln
(
"}"
)
...
...
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