projects
/
cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5e19cba
)
new test case for reassigning the dict variable during iteration
author
Stefan Behnel
<scoder@users.berlios.de>
Thu, 27 Nov 2008 13:27:48 +0000
(14:27 +0100)
committer
Stefan Behnel
<scoder@users.berlios.de>
Thu, 27 Nov 2008 13:27:48 +0000
(14:27 +0100)
tests/run/iterdict.pyx
patch
|
blob
|
history
diff --git
a/tests/run/iterdict.pyx
b/tests/run/iterdict.pyx
index 14d3ed7dac5bf39c39580c3e9f4d93d177fe07c7..b541f9577ec97a3ba8d218a35091706c36f20620 100644
(file)
--- a/
tests/run/iterdict.pyx
+++ b/
tests/run/iterdict.pyx
@@
-16,6
+16,8
@@
__doc__ = u"""
[10, 11, 12, 13]
>>> iterdict(d)
[10, 11, 12, 13]
+>>> iterdict_reassign(d)
+[10, 11, 12, 13]
>>> iterdict_int(d)
[10, 11, 12, 13]
>>> itervalues(d)
@@
-83,6
+85,15
@@
def iterdict_int(dict d):
l.sort()
return l
+def iterdict_reassign(dict d):
+ cdef dict d_new = {}
+ l = []
+ for k in d:
+ d = d_new
+ l.append(k)
+ l.sort()
+ return l
+
def itervalues(dict d):
l = []
for v in d.itervalues():