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
a69a2c71
Commit
a69a2c71
authored
Mar 23, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2.4 test fix
parent
3e310ce3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
tests/run/generators_in_refcycles.pyx
tests/run/generators_in_refcycles.pyx
+10
-3
No files found.
tests/run/generators_in_refcycles.pyx
View file @
a69a2c71
import
sys
def
_next
(
it
):
if
sys
.
version_info
[
0
]
>=
3
:
return
next
(
it
)
else
:
return
it
.
next
()
def
test_reference_cycle_cleanup
():
"""
>>> import gc
>>> delegator, gen,
next,
deleted = test_reference_cycle_cleanup()
>>> delegator, gen, deleted = test_reference_cycle_cleanup()
>>> next(delegator(gen()))
>>>
_
next(delegator(gen()))
123
>>> _ = gc.collect(); print(sorted(deleted))
['bar', 'foo']
...
...
@@ -26,4 +33,4 @@ def test_reference_cycle_cleanup():
while
True
:
yield
123
return
delegator
,
gen
,
next
,
deleted
return
delegator
,
gen
,
deleted
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