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
403fe34a
Commit
403fe34a
authored
Dec 10, 2010
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TryExceptStatNode: save previous exception state in temps
parent
940d2711
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
Cython/Compiler/Naming.py
Cython/Compiler/Naming.py
+0
-4
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+16
-13
No files found.
Cython/Compiler/Naming.py
View file @
403fe34a
...
@@ -109,10 +109,6 @@ exc_lineno_name = pyrex_prefix + "exc_lineno"
...
@@ -109,10 +109,6 @@ exc_lineno_name = pyrex_prefix + "exc_lineno"
exc_vars
=
(
exc_type_name
,
exc_value_name
,
exc_tb_name
)
exc_vars
=
(
exc_type_name
,
exc_value_name
,
exc_tb_name
)
exc_save_vars
=
(
pyrex_prefix
+
'save_exc_type'
,
pyrex_prefix
+
'save_exc_value'
,
pyrex_prefix
+
'save_exc_tb'
)
api_name
=
pyrex_prefix
+
"capi__"
api_name
=
pyrex_prefix
+
"capi__"
h_guard_prefix
=
"__PYX_HAVE__"
h_guard_prefix
=
"__PYX_HAVE__"
...
...
Cython/Compiler/Nodes.py
View file @
403fe34a
...
@@ -4746,12 +4746,12 @@ class TryExceptStatNode(StatNode):
...
@@ -4746,12 +4746,12 @@ class TryExceptStatNode(StatNode):
try_continue_label
=
code
.
new_label
(
'try_continue'
)
try_continue_label
=
code
.
new_label
(
'try_continue'
)
try_end_label
=
code
.
new_label
(
'try_end'
)
try_end_label
=
code
.
new_label
(
'try_end'
)
exc_save_vars
=
[
code
.
funcstate
.
allocate_temp
(
py_object_type
,
False
)
for
i
in
xrange
(
3
)]
code
.
putln
(
"{"
)
code
.
putln
(
"{"
)
code
.
putln
(
"PyObject %s;"
%
', '
.
join
([
'*%s'
%
var
for
var
in
Naming
.
exc_save_vars
]))
code
.
putln
(
"__Pyx_ExceptionSave(%s);"
%
code
.
putln
(
"__Pyx_ExceptionSave(%s);"
%
', '
.
join
([
'&%s'
%
var
for
var
in
Naming
.
exc_save_vars
]))
', '
.
join
([
'&%s'
%
var
for
var
in
exc_save_vars
]))
for
var
in
Naming
.
exc_save_vars
:
for
var
in
exc_save_vars
:
code
.
put_xgotref
(
var
)
code
.
put_xgotref
(
var
)
code
.
putln
(
code
.
putln
(
"/*try:*/ {"
)
"/*try:*/ {"
)
...
@@ -4770,14 +4770,14 @@ class TryExceptStatNode(StatNode):
...
@@ -4770,14 +4770,14 @@ class TryExceptStatNode(StatNode):
self
.
else_clause
.
generate_execution_code
(
code
)
self
.
else_clause
.
generate_execution_code
(
code
)
code
.
putln
(
code
.
putln
(
"}"
)
"}"
)
for
var
in
Naming
.
exc_save_vars
:
for
var
in
exc_save_vars
:
code
.
put_xdecref_clear
(
var
,
py_object_type
)
code
.
put_xdecref_clear
(
var
,
py_object_type
)
code
.
put_goto
(
try_end_label
)
code
.
put_goto
(
try_end_label
)
if
code
.
label_used
(
try_return_label
):
if
code
.
label_used
(
try_return_label
):
code
.
put_label
(
try_return_label
)
code
.
put_label
(
try_return_label
)
for
var
in
Naming
.
exc_save_vars
:
code
.
put_xgiveref
(
var
)
for
var
in
exc_save_vars
:
code
.
put_xgiveref
(
var
)
code
.
putln
(
"__Pyx_ExceptionReset(%s);"
%
code
.
putln
(
"__Pyx_ExceptionReset(%s);"
%
', '
.
join
(
Naming
.
exc_save_vars
))
', '
.
join
(
exc_save_vars
))
code
.
put_goto
(
old_return_label
)
code
.
put_goto
(
old_return_label
)
code
.
put_label
(
our_error_label
)
code
.
put_label
(
our_error_label
)
for
temp_name
,
type
in
temps_to_clean_up
:
for
temp_name
,
type
in
temps_to_clean_up
:
...
@@ -4789,9 +4789,9 @@ class TryExceptStatNode(StatNode):
...
@@ -4789,9 +4789,9 @@ class TryExceptStatNode(StatNode):
if
error_label_used
or
not
self
.
has_default_clause
:
if
error_label_used
or
not
self
.
has_default_clause
:
if
error_label_used
:
if
error_label_used
:
code
.
put_label
(
except_error_label
)
code
.
put_label
(
except_error_label
)
for
var
in
Naming
.
exc_save_vars
:
code
.
put_xgiveref
(
var
)
for
var
in
exc_save_vars
:
code
.
put_xgiveref
(
var
)
code
.
putln
(
"__Pyx_ExceptionReset(%s);"
%
code
.
putln
(
"__Pyx_ExceptionReset(%s);"
%
', '
.
join
(
Naming
.
exc_save_vars
))
', '
.
join
(
exc_save_vars
))
code
.
put_goto
(
old_error_label
)
code
.
put_goto
(
old_error_label
)
for
exit_label
,
old_label
in
zip
(
for
exit_label
,
old_label
in
zip
(
...
@@ -4800,19 +4800,22 @@ class TryExceptStatNode(StatNode):
...
@@ -4800,19 +4800,22 @@ class TryExceptStatNode(StatNode):
if
code
.
label_used
(
exit_label
):
if
code
.
label_used
(
exit_label
):
code
.
put_label
(
exit_label
)
code
.
put_label
(
exit_label
)
for
var
in
Naming
.
exc_save_vars
:
code
.
put_xgiveref
(
var
)
for
var
in
exc_save_vars
:
code
.
put_xgiveref
(
var
)
code
.
putln
(
"__Pyx_ExceptionReset(%s);"
%
code
.
putln
(
"__Pyx_ExceptionReset(%s);"
%
', '
.
join
(
Naming
.
exc_save_vars
))
', '
.
join
(
exc_save_vars
))
code
.
put_goto
(
old_label
)
code
.
put_goto
(
old_label
)
if
code
.
label_used
(
except_end_label
):
if
code
.
label_used
(
except_end_label
):
code
.
put_label
(
except_end_label
)
code
.
put_label
(
except_end_label
)
for
var
in
Naming
.
exc_save_vars
:
code
.
put_xgiveref
(
var
)
for
var
in
exc_save_vars
:
code
.
put_xgiveref
(
var
)
code
.
putln
(
"__Pyx_ExceptionReset(%s);"
%
code
.
putln
(
"__Pyx_ExceptionReset(%s);"
%
', '
.
join
(
Naming
.
exc_save_vars
))
', '
.
join
(
exc_save_vars
))
code
.
put_label
(
try_end_label
)
code
.
put_label
(
try_end_label
)
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
for
cname
in
exc_save_vars
:
code
.
funcstate
.
release_temp
(
cname
)
code
.
return_label
=
old_return_label
code
.
return_label
=
old_return_label
code
.
break_label
=
old_break_label
code
.
break_label
=
old_break_label
code
.
continue_label
=
old_continue_label
code
.
continue_label
=
old_continue_label
...
...
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