From 19807a85522b338608a64cf64ab740de4352fc19 2015-03-25 17:40:15 From: Min RK Date: 2015-03-25 17:40:15 Subject: [PATCH] copy `__spec__` in shim module for Python 3.4 --- 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