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
08fb6d10
Commit
08fb6d10
authored
Oct 12, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small refactoring and cleanup in try-except code generation
parent
4af72346
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
53 deletions
+15
-53
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+15
-53
No files found.
Cython/Compiler/Nodes.py
View file @
08fb6d10
...
...
@@ -3479,15 +3479,11 @@ class RaiseStatNode(StatNode):
tb_code
=
self
.
exc_tb
.
py_result
()
else
:
tb_code
=
"0"
if
self
.
exc_type
or
self
.
exc_value
or
self
.
exc_tb
:
code
.
putln
(
"__Pyx_Raise(%s, %s, %s);"
%
(
type_code
,
value_code
,
tb_code
))
else
:
code
.
putln
(
"__Pyx_ReRaise();"
)
code
.
putln
(
"__Pyx_Raise(%s, %s, %s);"
%
(
type_code
,
value_code
,
tb_code
))
for
obj
in
(
self
.
exc_type
,
self
.
exc_value
,
self
.
exc_tb
):
if
obj
:
obj
.
generate_disposal_code
(
code
)
...
...
@@ -4144,27 +4140,17 @@ class TryExceptStatNode(StatNode):
for
var
in
Naming
.
exc_save_vars
:
code
.
put_xdecref
(
var
,
py_object_type
)
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
(
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
)
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_return_label
)
for
exit_label
,
old_label
in
zip
(
[
try_break_label
,
try_continue_label
,
except_return_label
],
[
old_break_label
,
old_continue_label
,
old_return_label
]):
if
code
.
label_used
(
exit_label
):
code
.
put_label
(
exit_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_label
)
if
code
.
label_used
(
except_end_label
):
code
.
put_label
(
except_end_label
)
...
...
@@ -5006,30 +4992,6 @@ raise_error:
#------------------------------------------------------------------------------------
reraise_utility_code
=
UtilityCode
(
proto
=
"""
static void __Pyx_ReRaise(void); /*proto*/
"""
,
impl
=
"""
static void __Pyx_ReRaise(void) {
PyThreadState *tstate = PyThreadState_GET();
PyObject* tmp_type = tstate->curexc_type;
PyObject* tmp_value = tstate->curexc_value;
PyObject* tmp_tb = tstate->curexc_traceback;
tstate->curexc_type = tstate->exc_type;
tstate->curexc_value = tstate->exc_value;
tstate->curexc_traceback = tstate->exc_traceback;
tstate->exc_type = 0;
tstate->exc_value = 0;
tstate->exc_traceback = 0;
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
}
"""
)
#------------------------------------------------------------------------------------
arg_type_test_utility_code
=
UtilityCode
(
proto
=
"""
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
...
...
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