From 5c55c30870a7be493eb007a4200f214f79d8ad35 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 27 Nov 2008 14:27:48 +0100 Subject: [PATCH] new test case for reassigning the dict variable during iteration --- tests/run/iterdict.pyx | 11 +++++++++++ 1 file changed, 11 insertions(+) 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(): -- 2.26.2