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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
778293e8
Commit
778293e8
authored
Feb 20, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memleak when break used in try statement
parent
3d9eb90d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+12
-4
No files found.
Cython/Compiler/Nodes.py
View file @
778293e8
...
@@ -3310,9 +3310,6 @@ class BreakStatNode(StatNode):
...
@@ -3310,9 +3310,6 @@ class BreakStatNode(StatNode):
if
not
code
.
break_label
:
if
not
code
.
break_label
:
error
(
self
.
pos
,
"break statement not inside loop"
)
error
(
self
.
pos
,
"break statement not inside loop"
)
else
:
else
:
#code.putln(
# "goto %s;" %
# code.break_label)
code
.
put_goto
(
code
.
break_label
)
code
.
put_goto
(
code
.
break_label
)
...
@@ -4041,13 +4038,15 @@ class TryExceptStatNode(StatNode):
...
@@ -4041,13 +4038,15 @@ class TryExceptStatNode(StatNode):
def
generate_execution_code
(
self
,
code
):
def
generate_execution_code
(
self
,
code
):
old_return_label
=
code
.
return_label
old_return_label
=
code
.
return_label
old_break_label
=
code
.
break_label
old_error_label
=
code
.
new_error_label
()
old_error_label
=
code
.
new_error_label
()
our_error_label
=
code
.
error_label
our_error_label
=
code
.
error_label
except_end_label
=
code
.
new_label
(
'exception_handled'
)
except_end_label
=
code
.
new_label
(
'exception_handled'
)
except_error_label
=
code
.
new_label
(
'except_error'
)
except_error_label
=
code
.
new_label
(
'except_error'
)
except_return_label
=
code
.
new_label
(
'except_return'
)
except_return_label
=
code
.
new_label
(
'except_return'
)
try_return_label
=
code
.
new_label
(
'try_return'
)
try_return_label
=
code
.
new_label
(
'try_return'
)
try_end_label
=
code
.
new_label
(
'try'
)
try_break_label
=
code
.
new_label
(
'try_break'
)
try_end_label
=
code
.
new_label
(
'try_end'
)
code
.
putln
(
"{"
)
code
.
putln
(
"{"
)
code
.
putln
(
"PyObject %s;"
%
code
.
putln
(
"PyObject %s;"
%
...
@@ -4059,6 +4058,7 @@ class TryExceptStatNode(StatNode):
...
@@ -4059,6 +4058,7 @@ class TryExceptStatNode(StatNode):
code
.
putln
(
code
.
putln
(
"/*try:*/ {"
)
"/*try:*/ {"
)
code
.
return_label
=
try_return_label
code
.
return_label
=
try_return_label
code
.
break_label
=
try_break_label
self
.
body
.
generate_execution_code
(
code
)
self
.
body
.
generate_execution_code
(
code
)
code
.
putln
(
code
.
putln
(
"}"
)
"}"
)
...
@@ -4093,6 +4093,13 @@ class TryExceptStatNode(StatNode):
...
@@ -4093,6 +4093,13 @@ class TryExceptStatNode(StatNode):
for
var
in
Naming
.
exc_save_vars
:
for
var
in
Naming
.
exc_save_vars
:
code
.
put_xdecref
(
var
,
py_object_type
)
code
.
put_xdecref
(
var
,
py_object_type
)
code
.
put_goto
(
old_error_label
)
code
.
put_goto
(
old_error_label
)
if
code
.
label_used
(
try_break_label
):
code
.
put_label
(
try_break_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_break_label
)
if
code
.
label_used
(
except_return_label
):
if
code
.
label_used
(
except_return_label
):
code
.
put_label
(
except_return_label
)
code
.
put_label
(
except_return_label
)
...
@@ -4110,6 +4117,7 @@ class TryExceptStatNode(StatNode):
...
@@ -4110,6 +4117,7 @@ class TryExceptStatNode(StatNode):
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
code
.
return_label
=
old_return_label
code
.
return_label
=
old_return_label
code
.
break_label
=
old_break_label
code
.
error_label
=
old_error_label
code
.
error_label
=
old_error_label
def
annotate
(
self
,
code
):
def
annotate
(
self
,
code
):
...
...
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