From: Stefan Behnel Date: Thu, 27 Nov 2008 13:27:48 +0000 (+0100) Subject: new test case for reassigning the dict variable during iteration X-Git-Tag: 0.11-beta~199 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5c55c30870a7be493eb007a4200f214f79d8ad35;p=cython.git new test case for reassigning the dict variable during iteration --- diff --git a/tests/run/iterdict.pyx b/tests/run/iterdict.pyx index 14d3ed7d..b541f957 100644 --- 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():