Add a sanity check in _preload_portage_submodules() to ensure that the
authorZac Medico <zmedico@gentoo.org>
Wed, 4 Aug 2010 07:50:25 +0000 (00:50 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 4 Aug 2010 07:50:25 +0000 (00:50 -0700)
loop always terminates.

pym/portage/proxy/lazyimport.py

index b5a2385d3ead173e2b17f42a9d15a1f00e0b1c03..b5d15931bb3ff733e93aa852c4b347b94f9c72c1 100644 (file)
@@ -28,10 +28,14 @@ def _preload_portage_submodules():
        so some portage submodules may still remain unimported
        after this function is called.
        """
+       imported = set()
        while True:
                remaining = False
                for name in list(_module_proxies):
                        if name.startswith('portage.'):
+                               if name in imported:
+                                       continue
+                               imported.add(name)
                                remaining = True
                                __import__(name)
                                _unregister_module_proxy(name)