Use StopIteration to exit nested loops. v2.2_rc70
authorZac Medico <zmedico@gentoo.org>
Sat, 28 Aug 2010 02:15:50 +0000 (19:15 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 28 Aug 2010 02:15:50 +0000 (19:15 -0700)
pym/portage/dep/__init__.py

index c5f6a0b63a0f131fa0990939ce4787c294be26ce..382a4f611e3e00562dcf4abf6baa790d7915128c 100644 (file)
@@ -1087,11 +1087,15 @@ class Atom(_atom_base):
                                                % (eapi, self), category='EAPI.incompatible')
                                if is_valid_flag is not None and self.use.conditional:
                                        invalid_flag = None
-                                       for conditional_type, flags in self.use.conditional.items():
-                                               for flag in flags:
-                                                       if not is_valid_flag(flag):
-                                                               invalid_flag = (conditional_type, flag)
-                                                               break
+                                       try:
+                                               for conditional_type, flags in \
+                                                       self.use.conditional.items():
+                                                       for flag in flags:
+                                                               if not is_valid_flag(flag):
+                                                                       invalid_flag = (conditional_type, flag)
+                                                                       raise StopIteration()
+                                       except StopIteration:
+                                               pass
                                        if invalid_flag is not None:
                                                conditional_type, flag = invalid_flag
                                                conditional_str = _use_dep._conditional_strings[conditional_type]