summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-06-29 10:44:41 -0700
committerBenjamin Peterson <benjamin@python.org>2014-06-29 10:44:41 -0700
commitb2cb78a8a0a2da037e56d981e22450089240e6e4 (patch)
tree3904634bf650c4dc9134eed8e41a2dc9507da2c2
parente8a1a60a87ffa293aa6b1eeda2496cb5ca36971c (diff)
downloadsix-b2cb78a8a0a2da037e56d981e22450089240e6e4.tar.gz
account for __spec__ possibly being None (fixes #77)
-rw-r--r--CHANGES2
-rw-r--r--six.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index bb3143b..acb2cde 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,8 @@ This file lists the changes in each six version.
Development version
-------------------
+- Issue #77: Fix import six on Python 3.4 with a custom loader.
+
- Issue #74: six.moves.xmlrpc_server should map to SimpleXMLRPCServer on Python
2 as documented not xmlrpclib.
diff --git a/six.py b/six.py
index 940f46c..d42ac04 100644
--- a/six.py
+++ b/six.py
@@ -734,10 +734,8 @@ def add_metaclass(metaclass):
# Turn this module into a package.
__path__ = [] # required for PEP 302 and PEP 451
__package__ = __name__ # see PEP 366 @ReservedAssignment
-try:
+if globals().get("__spec__") is not None:
__spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable
-except NameError:
- pass
# Remove other six meta path importers, since they cause problems. This can
# happen if six is removed from sys.modules and then reloaded. (Setuptools does
# this for some reason.)