From: Zac Medico Date: Tue, 2 Oct 2012 20:22:57 +0000 (-0700) Subject: OrderedDict: fix setitem bug #436974 X-Git-Tag: v2.2.0_alpha135~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6571d8b160e2e5d10ef76fcc5fba288d3e494d3e;p=portage.git 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. --- 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)