diff --git a/IPython/utils/shimmodule.py b/IPython/utils/shimmodule.py
index 9b91f27..1ce9043 100644
--- a/IPython/utils/shimmodule.py
+++ b/IPython/utils/shimmodule.py
@@ -3,6 +3,7 @@
 # Copyright (c) IPython Development Team.
 # Distributed under the terms of the Modified BSD License.
 
+import sys
 import types
 
 class ShimModule(types.ModuleType):
@@ -10,6 +11,8 @@ class ShimModule(types.ModuleType):
     def __init__(self, *args, **kwargs):
         self._mirror = kwargs.pop("mirror")
         super(ShimModule, self).__init__(*args, **kwargs)
+        if sys.version_info >= (3,4):
+            self.__spec__ = __import__(self._mirror).__spec__
 
     def __getattr__(self, key):
         # Use the equivalent of import_item(name), see below