From 76539b36ef786a7ddded66a31a3377e0c547dcf9 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 2 Jun 2003 06:47:53 +0000 Subject: [PATCH] Made it so if IndexError is raised, the data structure isn't modified in __delitem__ --- src/structures.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/structures.py b/src/structures.py index 32496c7e2..2bde35457 100644 --- a/src/structures.py +++ b/src/structures.py @@ -228,6 +228,10 @@ class queue(object): if len(range) != len(value): raise ValueError, 'seq must be the same length as slice.' else: + for i in range: + (m, idx) = divmod(oidx, len(self)) + if m and m != -1: + raise IndexError, oidx for (i, x) in zip(range, value): self[i] = x else: