summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-11 05:45:49 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-11 05:45:49 +0000
commitfc2e5227451c6a4838bc26e85792c9e247627d69 (patch)
tree3cf06e7bd15f5de1f7a1d426c426411238ea4604
parent029a8562fa608b4a42f01c924f7c20ce0f8c2924 (diff)
downloadportage-fc2e5227451c6a4838bc26e85792c9e247627d69.tar.gz
portage-fc2e5227451c6a4838bc26e85792c9e247627d69.tar.bz2
portage-fc2e5227451c6a4838bc26e85792c9e247627d69.zip
Fix classes that implement __iter__() to copy it to their keys() method
when running under >=python-3.0. (trunk r12632) svn path=/main/branches/2.1.6/; revision=12905
-rw-r--r--pym/portage/cache/mappings.py9
-rw-r--r--pym/portage/cache/sql_template.py1
2 files changed, 10 insertions, 0 deletions
diff --git a/pym/portage/cache/mappings.py b/pym/portage/cache/mappings.py
index a767e1bc5..5fe836daa 100644
--- a/pym/portage/cache/mappings.py
+++ b/pym/portage/cache/mappings.py
@@ -165,6 +165,9 @@ class UserDict(MutableMapping):
def clear(self):
self.data.clear()
+ if sys.hexversion >= 0x3000000:
+ keys = __iter__
+
class ProtectedDict(MutableMapping):
"""
given an initial dict, this wraps that dict storing changes in a secondary dict, protecting
@@ -218,6 +221,9 @@ class ProtectedDict(MutableMapping):
DeprecationWarning)
return key in self
+ if sys.hexversion >= 0x3000000:
+ keys = __iter__
+
class LazyLoad(Mapping):
"""
Lazy loading of values for a dict
@@ -259,6 +265,9 @@ class LazyLoad(Mapping):
self.pull = None
return key in self.d
+ if sys.hexversion >= 0x3000000:
+ keys = __iter__
+
_slot_dict_classes = weakref.WeakValueDictionary()
def slot_dict_class(keys, prefix="_val_"):
diff --git a/pym/portage/cache/sql_template.py b/pym/portage/cache/sql_template.py
index e5903cd67..47bef9124 100644
--- a/pym/portage/cache/sql_template.py
+++ b/pym/portage/cache/sql_template.py
@@ -280,3 +280,4 @@ class SQLDatabase(template.database):
if sys.hexversion >= 0x3000000:
items = iteritems
+ keys = __iter__