From 6571d8b160e2e5d10ef76fcc5fba288d3e494d3e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 2 Oct 2012 13:22:57 -0700 Subject: [PATCH] OrderedDict: fix setitem bug #436974 This fixes some strange behavior triggered during fetch, which is only observable with Python 2.6 since it doesn't have collections.OrderedDict. --- pym/portage/cache/mappings.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pym/portage/cache/mappings.py b/pym/portage/cache/mappings.py index bc8ce9af8..cd39a6ea1 100644 --- a/pym/portage/cache/mappings.py +++ b/pym/portage/cache/mappings.py @@ -199,10 +199,10 @@ class OrderedDict(UserDict): return iter(self._order) def __setitem__(self, key, item): - if key in self: - self._order.remove(key) + new_key = key not in self UserDict.__setitem__(self, key, item) - self._order.append(key) + if new_key: + self._order.append(key) def __delitem__(self, key): UserDict.__delitem__(self, key) -- 2.26.2