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
a7e2f3c0
Commit
a7e2f3c0
authored
Jun 05, 2020
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.29.x'
parents
5500fbb7
bbef4d74
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
7 deletions
+42
-7
CHANGES.rst
CHANGES.rst
+4
-0
Cython/Compiler/FlowControl.py
Cython/Compiler/FlowControl.py
+12
-7
tests/run/cython3.pyx
tests/run/cython3.pyx
+26
-0
No files found.
CHANGES.rst
View file @
a7e2f3c0
...
...
@@ -454,6 +454,10 @@ Other changes
Bugs
fixed
----------
*
Nested
try
-
except
statements
with
multiple
``
return
``
statements
could
crash
due
to
incorrect
deletion
of
the
``
except
as
``
target
variable
.
(
Github
issue
#
3666
)
*
The
``@
classmethod
``
decorator
no
longer
rejects
unknown
input
from
other
decorators
.
Patch
by
David
Woods
.
(
Github
issue
#
3660
)
...
...
Cython/Compiler/FlowControl.py
View file @
a7e2f3c0
...
...
@@ -1220,8 +1220,6 @@ class ControlFlowAnalysis(CythonTransform):
if
self
.
flow
.
loops
:
self
.
flow
.
loops
[
-
1
].
exceptions
.
append
(
descr
)
self
.
flow
.
block
=
body_block
## XXX: Is it still required
body_block
.
add_child
(
entry_point
)
self
.
flow
.
nextblock
()
self
.
_visit
(
node
.
body
)
self
.
flow
.
exceptions
.
pop
()
...
...
@@ -1255,11 +1253,18 @@ class ControlFlowAnalysis(CythonTransform):
self
.
mark_position
(
node
)
self
.
visitchildren
(
node
)
for
exception
in
self
.
flow
.
exceptions
[::
-
1
]:
if
exception
.
finally_enter
:
self
.
flow
.
block
.
add_child
(
exception
.
finally_enter
)
if
exception
.
finally_exit
:
exception
.
finally_exit
.
add_child
(
self
.
flow
.
exit_point
)
outer_exception_handlers
=
iter
(
self
.
flow
.
exceptions
[::
-
1
])
for
handler
in
outer_exception_handlers
:
if
handler
.
finally_enter
:
self
.
flow
.
block
.
add_child
(
handler
.
finally_enter
)
if
handler
.
finally_exit
:
# 'return' goes to function exit, or to the next outer 'finally' clause
exit_point
=
self
.
flow
.
exit_point
for
next_handler
in
outer_exception_handlers
:
if
next_handler
.
finally_enter
:
exit_point
=
next_handler
.
finally_enter
break
handler
.
finally_exit
.
add_child
(
exit_point
)
break
else
:
if
self
.
flow
.
block
:
...
...
tests/run/cython3.pyx
View file @
a7e2f3c0
...
...
@@ -270,6 +270,32 @@ def except_as_deletes_target_in_gen(x, a):
yield
6
def
nested_except_gh3666
(
a
=
False
,
b
=
False
):
"""
>>> nested_except_gh3666()
'A'
>>> nested_except_gh3666(a=True)
'B-V'
>>> nested_except_gh3666(a=True, b=True)
'B-V-T'
"""
try
:
if
a
:
raise
ValueError
return
"A"
except
TypeError
as
exc
:
return
"A-T"
except
ValueError
as
exc
:
try
:
if
b
:
raise
TypeError
return
"B-V"
except
ValueError
as
exc
:
return
"B-V-V"
except
TypeError
as
exc
:
return
"B-V-T"
### Py3 feature tests
def
print_function
(
*
args
):
...
...
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