Commits

Benjamin Peterson committed 38d0a84

make fake modules pretend not to have __path__ (fixes #56)

Comments (0)

Files changed (2)

 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.
         # __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)