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
Kirill Smelkov
cython
Commits
03f1a3ce
Commit
03f1a3ce
authored
Nov 25, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test that functions that do not need a closure know they do not need it
parent
8f516cc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
tests/run/closures_T82.pyx
tests/run/closures_T82.pyx
+17
-1
No files found.
tests/run/closures_T82.pyx
View file @
03f1a3ce
cimport
cython
def
add_n
(
int
n
):
"""
>>> f = add_n(3)
...
...
@@ -185,6 +187,12 @@ def more_inner_funcs(x):
return
f
(
a_f
),
g
(
b_g
),
h
(
b_h
)
return
resolve
@
cython
.
test_assert_path_exists
(
"//DefNode//DefNode//DefNode//DefNode"
,
"//DefNode[@needs_outer_scope = False]"
,
# deep_inner()
"//DefNode//DefNode//DefNode//DefNode[@needs_closure = False]"
,
# h()
)
@
cython
.
test_fail_if_path_exists
(
"//DefNode//DefNode[@needs_outer_scope = False]"
)
def
deep_inner
():
"""
>>> deep_inner()()
...
...
@@ -199,6 +207,12 @@ def deep_inner():
return
g
()
return
f
()
@
cython
.
test_assert_path_exists
(
"//DefNode//DefNode//DefNode"
,
"//DefNode//DefNode//DefNode[@needs_outer_scope = False]"
,
# a()
"//DefNode//DefNode//DefNode[@needs_closure = False]"
,
# a(), g(), h()
)
@
cython
.
test_fail_if_path_exists
(
"//DefNode//DefNode//DefNode[@needs_closure = True]"
)
# a(), g(), h()
def
deep_inner_sibling
():
"""
>>> deep_inner_sibling()()
...
...
@@ -206,8 +220,10 @@ def deep_inner_sibling():
"""
cdef
int
x
=
1
def
f
():
def
a
():
return
1
def
g
():
return
x
+
1
return
x
+
a
()
def
h
():
return
g
()
return
h
...
...
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