projects
/
portage.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b110b9f
)
Fix lazyimport() to handle partially imported modules by creating
author
Zac Medico
<zmedico@gentoo.org>
Thu, 12 Aug 2010 10:56:20 +0000
(
03:56
-0700)
committer
Zac Medico
<zmedico@gentoo.org>
Thu, 12 Aug 2010 10:56:20 +0000
(
03:56
-0700)
proxies, instead of raising ImportError.
pym/portage/proxy/lazyimport.py
patch
|
blob
|
history
diff --git
a/pym/portage/proxy/lazyimport.py
b/pym/portage/proxy/lazyimport.py
index b5d15931bb3ff733e93aa852c4b347b94f9c72c1..d878b7adcecb91ed0dea403983c991e21edfe995 100644
(file)
--- a/
pym/portage/proxy/lazyimport.py
+++ b/
pym/portage/proxy/lazyimport.py
@@
-199,7
+199,11
@@
def lazyimport(scope, *args):
try:
scope[alias] = getattr(already_imported, attr_name)
except AttributeError:
- raise ImportError('cannot import name %s' % attr_name)
+ # Apparently the target module is only partially
+ # imported, so create a proxy.
+ already_imported = None
+ scope[alias] = \
+ _LazyImportFrom(scope, name, attr_name, alias)
else:
scope[alias] = \
_LazyImportFrom(scope, name, attr_name, alias)