[yum-commits] Branch 'yum-3_2_X' - 2 commits - yum/packages.py yum/rpmsack.py yum/sqlitesack.py
James Antill
james at osuosl.org
Tue Jul 7 18:34:10 UTC 2009
yum/packages.py | 10 +++-------
yum/rpmsack.py | 5 +++--
yum/sqlitesack.py | 5 +++--
3 files changed, 9 insertions(+), 11 deletions(-)
New commits:
commit e4a941205360c172aac882e7bb1b9ed573106fb6
Author: James Antill <james at and.org>
Date: Tue Jul 7 14:29:48 2009 -0400
Real fix for BZ 508445. We were doing inf. recursion in __getattr__ due
to d03389725e3779928d721370aed9e14afb5304a6.
Real fix is to not test, as we only get there when they don't exist.
diff --git a/yum/packages.py b/yum/packages.py
index d4838ee..86f8c91 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -1121,8 +1121,9 @@ class YumHeaderPackage(YumAvailablePackage):
#FIXME - if an error - return AttributeError, not KeyError
# ONLY FIX THIS AFTER THE API BREAK
if thing.startswith('__') and thing.endswith('__'):
- if not hasattr(self, thing):
- raise AttributeError, "%s has no attribute %s" % (self, thing)
+ # If these existed, then we wouldn't get here ...
+ # So these are missing.
+ raise AttributeError, "%s has no attribute %s" % (self, thing)
try:
return self.hdr[thing]
except KeyError:
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index dbf01f9..c3c7265 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -65,9 +65,10 @@ class RPMInstalledPackage(YumInstalledPackage):
def __getattr__(self, varname):
self.hdr = val = self._get_hdr()
self._has_hdr = True
+ # If these existed, then we wouldn't get here ... and nothing in the DB
+ # starts and ends with __'s. So these are missing.
if varname.startswith('__') and varname.endswith('__'):
- if not hasattr(self, varname):
- raise AttributeError, "%s has no attribute %s" % (self, varname)
+ raise AttributeError, "%s has no attribute %s" % (self, varname)
if varname != 'hdr': # This is unusual, for anything that happens
val = val[varname] # a lot we should preload at __init__.
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 5692c07..013156e 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -191,9 +191,10 @@ class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase):
'checksum_value' : 'pkgId',
}
+ # If these existed, then we wouldn't get here ... and nothing in the DB
+ # starts and ends with __'s. So these are missing.
if varname.startswith('__') and varname.endswith('__'):
- if not hasattr(self, varname):
- raise AttributeError, varname
+ raise AttributeError, varname
dbname = varname
if db2simplemap.has_key(varname):
commit 7ff45d1640d05b0e78c6d74912e6729f6de79279
Author: James Antill <james at and.org>
Date: Tue Jul 7 14:27:03 2009 -0400
Revert "Fix speed regression in costExcludes (super magic)"
This reverts commit 1f45838e29ba26dac22215dd9c918fb920569fef.
This was a workaround, the language isn't bad we are. See next commit.
diff --git a/yum/packages.py b/yum/packages.py
index a124d7b..d4838ee 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -237,11 +237,6 @@ class PackageObject(object):
self.arch)
return out
- def __unicode__(self):
- """ This is here because unicode(pkg) is roughly 50x slower than
- str(pkg), and "%s" % (pkg,) uses unicode(). """
- return misc.to_unicode(self.__str__())
-
def verCMP(self, other):
""" Compare package to another one, only rpm-version ordering. """
if not other:
More information about the Yum-commits
mailing list