From 95b0a868f255f2766ae03733882f30c8c7f3b7ca Mon Sep 17 00:00:00 2001 From: Jeremy Heiner Date: Sat, 12 Oct 2013 12:44:33 -0400 Subject: Use dict iteration methods common to both Python 2 and 3. The .items, .keys, and .values methods in Python 2 make copies, so the test framework uses the .iter* flavors of those methods. But in Python 3 those .iter* (and even the 2.7 .view*) flavors are removed and the original methods return views. Measurements were taken under Python2 to see what impact the copying had, and there was none. Thus it is not worth the effort to avoid. Reported as a compatibility issue by 2to3. Signed-off-by: Jeremy Heiner Signed-off-by: Allan McRae --- test/pacman/pmtest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/pacman/pmtest.py') diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index 731a9fc7..a1f3645d 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -58,7 +58,7 @@ def findpkg(self, name, version, allow_local=False): """Find a package object matching the name and version specified in either sync databases or the local package collection. The local database is allowed to match if allow_local is True.""" - for db in self.db.itervalues(): + for db in self.db.values(): if db.is_local and not allow_local: continue pkg = db.getpkg(name) @@ -151,7 +151,7 @@ def generate(self, pacman): vprint("\t%s" % os.path.join(util.TMPDIR, pkg.filename())) pkg.finalize() pkg.makepkg(tmpdir) - for key, value in self.db.iteritems(): + for key, value in self.db.items(): for pkg in value.pkgs: pkg.finalize() if key == "local" and not self.createlocalpkgs: @@ -167,7 +167,7 @@ def generate(self, pacman): # Creating sync database archives vprint(" Creating databases") - for key, value in self.db.iteritems(): + for key, value in self.db.items(): vprint("\t" + value.treename) value.generate() -- cgit v1.2.3-54-g00ecf