Use isinstance() instead of handling TypeError.
authorZac Medico <zmedico@gentoo.org>
Tue, 10 Jun 2008 04:48:51 +0000 (04:48 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 10 Jun 2008 04:48:51 +0000 (04:48 -0000)
svn path=/main/trunk/; revision=10638

pym/portage/dbapi/vartree.py

index 190157b886aa65b5dd512be1e2e6d16a6ca35c88..f57555483a8e871a55c388d08e65595bca43ff26 100644 (file)
@@ -996,10 +996,8 @@ class vardbapi(dbapi):
                                pkgs = base_names.get(name_hash)
                                if pkgs is not None:
                                        for hash_value in pkgs:
-                                               try:
-                                                       if len(hash_value) != 3:
-                                                               continue
-                                               except TypeError:
+                                               if not isinstance(hash_value, tuple) or \
+                                                       len(hash_value) != 3:
                                                        continue
                                                cpv, counter, mtime = hash_value
                                                if not isinstance(cpv, basestring):