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
3ac9414c
Commit
3ac9414c
authored
Sep 04, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
c2386524
f767831f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
13 deletions
+47
-13
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+11
-12
runtests.py
runtests.py
+5
-1
tests/errors/e_exceptclause.pyx
tests/errors/e_exceptclause.pyx
+16
-0
tests/run/moduletryexcept.pyx
tests/run/moduletryexcept.pyx
+15
-0
No files found.
Cython/Compiler/Nodes.py
View file @
3ac9414c
...
...
@@ -3529,7 +3529,6 @@ class TryExceptStatNode(StatNode):
if
self
.
else_clause
:
self
.
else_clause
.
analyse_control_flow
(
env
)
env
.
finish_branching
(
self
.
end_pos
())
env
.
use_utility_code
(
reset_exception_utility_code
)
def
analyse_declarations
(
self
,
env
):
self
.
body
.
analyse_declarations
(
env
)
...
...
@@ -3538,13 +3537,19 @@ class TryExceptStatNode(StatNode):
if
self
.
else_clause
:
self
.
else_clause
.
analyse_declarations
(
env
)
self
.
gil_check
(
env
)
env
.
use_utility_code
(
reset_exception_utility_code
)
def
analyse_expressions
(
self
,
env
):
self
.
body
.
analyse_expressions
(
env
)
self
.
cleanup_list
=
env
.
free_temp_entries
[:]
default_clause_seen
=
0
for
except_clause
in
self
.
except_clauses
:
except_clause
.
analyse_expressions
(
env
)
if
default_clause_seen
:
error
(
except_clause
.
pos
,
"default 'except:' must be last"
)
if
not
except_clause
.
pattern
:
default_clause_seen
=
1
self
.
has_default_clause
=
default_clause_seen
if
self
.
else_clause
:
self
.
else_clause
.
analyse_expressions
(
env
)
self
.
gil_check
(
env
)
...
...
@@ -3581,19 +3586,13 @@ class TryExceptStatNode(StatNode):
code
.
put_goto
(
try_end_label
)
code
.
put_label
(
our_error_label
)
code
.
put_var_xdecrefs_clear
(
self
.
cleanup_list
)
default_clause_seen
=
0
for
except_clause
in
self
.
except_clauses
:
if
not
except_clause
.
pattern
:
default_clause_seen
=
1
else
:
if
default_clause_seen
:
error
(
except_clause
.
pos
,
"Default except clause not last"
)
except_clause
.
generate_handling_code
(
code
,
except_end_label
)
if
not
default_clause_seen
:
code
.
put_goto
(
code
.
error_label
)
if
code
.
label_used
(
except_error_label
):
code
.
put_label
(
except_error_label
)
error_label_used
=
code
.
label_used
(
except_error_label
)
if
error_label_used
or
not
self
.
has_default_clause
:
if
error_label_used
:
code
.
put_label
(
except_error_label
)
for
var
in
Naming
.
exc_save_vars
:
code
.
put_xdecref
(
var
,
py_object_type
)
code
.
put_goto
(
old_error_label
)
...
...
runtests.py
View file @
3ac9414c
...
...
@@ -117,9 +117,13 @@ class TestBuilder(object):
return
suite
def
build_tests
(
self
,
test_class
,
path
,
workdir
,
module
,
expect_errors
):
if
expect_errors
:
languages
=
self
.
languages
[:
1
]
else
:
languages
=
self
.
languages
tests
=
[
self
.
build_test
(
test_class
,
path
,
workdir
,
module
,
language
,
expect_errors
)
for
language
in
self
.
languages
]
for
language
in
languages
]
return
tests
def
build_test
(
self
,
test_class
,
path
,
workdir
,
module
,
...
...
tests/errors/e_exceptclause.pyx
0 → 100644
View file @
3ac9414c
try
:
raise
KeyError
except
KeyError
:
pass
except
:
pass
except
:
pass
except
AttributeError
:
pass
_ERRORS
=
u"""
8:0: default 'except:' must be last
10:0: default 'except:' must be last
"""
tests/run/moduletryexcept.pyx
0 → 100644
View file @
3ac9414c
__doc__
=
u"""
>>> a
2
"""
a
=
0
try
:
raise
KeyError
except
AttributeError
:
a
=
1
except
KeyError
:
a
=
2
except
:
a
=
3
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