summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-02-15 13:29:39 -0500
committerBenjamin Peterson <benjamin@python.org>2014-02-15 13:29:39 -0500
commita252f4285f27474da0c121d82c7e2d998e77e726 (patch)
treed1630864b764805360078b87446c4853da0eee81
parent52b4f4fd0fe9f12e9aa60d9ba4a46651d45e1138 (diff)
downloadsix-a252f4285f27474da0c121d82c7e2d998e77e726.tar.gz
make fake modules pretend not to have __path__ (fixes #56)
-rw-r--r--CHANGES3
-rw-r--r--six.py8
2 files changed, 8 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index b77c06d..0ee6460 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,9 @@ This file lists the changes in each six version.
Development version
-------------------
+- Issue #56: Make the fake modules six.moves puts into sys.modules appear not to
+ have a __path__ unless they are loaded.
+
- Pull request #28: Add support for SplitResult.
- Issue #55: Add move mapping for xmlrpc.server.
diff --git a/six.py b/six.py
index 83f59f9..bb6a90f 100644
--- a/six.py
+++ b/six.py
@@ -109,9 +109,11 @@ class MovedModule(_LazyDescr):
# __file__ or __name__ of every module in sys.modules. This doesn't work
# well if this MovedModule is for an module that is unavailable on this
# machine (like winreg on Unix systems). Thus, we pretend __file__ and
- # __name__ don't exist if the module hasn't been loaded yet. See issues
- # #51 and #53.
- if attr in ("__file__", "__name__") and self.mod not in sys.modules:
+ # __name__ don't exist if the module hasn't been loaded yet. We give
+ # __path__ the same treatment for Google AppEngine. See issues #51, #53
+ # and #56.
+ if (attr in ("__file__", "__name__", "__path__") and
+ self.mod not in sys.modules):
raise AttributeError
_module = self._resolve()
value = getattr(_module, attr)