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
Gwenaël Samain
cython
Commits
a6b0f405
Commit
a6b0f405
authored
Nov 24, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test case for ticket #598: scoped list comp in function closure
parent
bc9cdf44
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
tests/bugs.txt
tests/bugs.txt
+1
-0
tests/run/list_comp_in_closure_T598.pyx
tests/run/list_comp_in_closure_T598.pyx
+27
-0
No files found.
tests/bugs.txt
View file @
a6b0f405
...
@@ -17,6 +17,7 @@ function_as_method_T494
...
@@ -17,6 +17,7 @@ function_as_method_T494
closure_inside_cdef_T554
closure_inside_cdef_T554
ipow_crash_T562
ipow_crash_T562
pure_mode_cmethod_inheritance_T583
pure_mode_cmethod_inheritance_T583
list_comp_in_closure_T598
# CPython regression tests that don't current work:
# CPython regression tests that don't current work:
pyregr.test_threadsignals
pyregr.test_threadsignals
...
...
tests/run/list_comp_in_closure_T598.pyx
0 → 100644
View file @
a6b0f405
# cython: language_level=3
def
list_comp_in_closure
():
"""
>>> list_comp_in_closure()
[0, 4, 8]
"""
x
=
'abc'
def
f
():
return
x
result
=
[
x
*
2
for
x
in
range
(
5
)
if
x
%
2
==
0
]
assert
x
==
'abc'
# don't leak in Py3 code
assert
f
()
==
'abc'
# don't leak in Py3 code
return
result
def
genexpr_in_closure
():
"""
>>> genexpr_in_closure()
[0, 4, 8]
"""
x
=
'abc'
def
f
():
return
x
result
=
list
(
x
*
2
for
x
in
range
(
5
)
if
x
%
2
==
0
)
assert
x
==
'abc'
# don't leak in Py3 code
assert
f
()
==
'abc'
# don't leak in Py3 code
return
result
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