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
Boxiang Sun
cython
Commits
b070186e
Commit
b070186e
authored
May 21, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix error handling for closure creation in cdef void functions
parent
711059f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+11
-1
tests/run/closure_inside_cdef_T554.pyx
tests/run/closure_inside_cdef_T554.pyx
+19
-2
No files found.
Cython/Compiler/Nodes.py
View file @
b070186e
...
@@ -1829,7 +1829,17 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -1829,7 +1829,17 @@ class FuncDefNode(StatNode, BlockNode):
code
.
put_release_ensured_gil
()
code
.
put_release_ensured_gil
()
# FIXME: what if the error return value is a Python value?
# FIXME: what if the error return value is a Python value?
code
.
putln
(
"return %s;"
%
self
.
error_value
())
err_val
=
self
.
error_value
()
if
err_val
is
None
:
if
not
self
.
caller_will_check_exceptions
():
warning
(
self
.
entry
.
pos
,
"Unraisable exception in function '%s'."
%
self
.
entry
.
qualified_name
,
0
)
code
.
put_unraisable
(
self
.
entry
.
qualified_name
,
lenv
.
nogil
)
#if self.return_type.is_void:
code
.
putln
(
"return;"
)
else
:
code
.
putln
(
"return %s;"
%
err_val
)
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
code
.
put_gotref
(
Naming
.
cur_scope_cname
)
code
.
put_gotref
(
Naming
.
cur_scope_cname
)
# Note that it is unsafe to decref the scope at this point.
# Note that it is unsafe to decref the scope at this point.
...
...
tests/run/closure_inside_cdef_T554.pyx
View file @
b070186e
...
@@ -9,6 +9,23 @@ def call_f(x):
...
@@ -9,6 +9,23 @@ def call_f(x):
"""
"""
return
f
(
x
)
return
f
(
x
)
cdef
f
(
x
):
# def here => works fine
cdef
f
(
x
):
# def here => works fine
def
g
(
y
):
return
y
*
x
# cdef here => compile error
def
g
(
y
):
return
y
*
x
# cdef here => compile error
return
g
(
x
)
# faults@ INCREF(.*cur_scope->.*v_x
return
g
(
x
)
# faults@ INCREF(.*cur_scope->.*v_x
def
closure_in_void
():
"""
>>> genex = closure_in_void()
>>> list(genex)
['a', 'b', 'c']
"""
l
=
[]
add_gen
(
l
)
return
l
[
0
]
cdef
void
add_gen
(
l
):
x
=
"abc"
l
.
append
((
c
for
c
in
x
))
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