summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Abramowitz <marc@marc-abramowitz.com>2014-01-04 15:32:08 -0800
committerMarc Abramowitz <marc@marc-abramowitz.com>2014-01-04 15:32:08 -0800
commitf293ede1501e852dd16922eb33f6ede9d69edcc6 (patch)
tree56e0a7f68668cef4f4d606290bf154dae05e21b8
parentfa5c4166ea7f2bc537c3ce127bfae992a830da1f (diff)
downloadsix-f293ede1501e852dd16922eb33f6ede9d69edcc6.tar.gz
MovedModule.__getattr__: Set attribute on the lazy module, so __getattr__ isn't
invoked multiple times.
-rw-r--r--six.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/six.py b/six.py
index 9a8a9a3..4e53304 100644
--- a/six.py
+++ b/six.py
@@ -106,7 +106,9 @@ class MovedModule(_LazyDescr):
def __getattr__(self, attr):
_module = self._resolve()
- return getattr(_module, attr)
+ value = getattr(_module, attr)
+ setattr(self, attr, value)
+ return value
class _LazyModule(types.ModuleType):