summaryrefslogtreecommitdiffstats
path: root/Lib/collections/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/collections/__init__.py')
-rw-r--r--Lib/collections/__init__.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index fc60e13..6794de1 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -7,7 +7,6 @@ from _collections_abc import *
import _collections_abc
__all__ += _collections_abc.__all__
-from _collections import deque, defaultdict
from operator import itemgetter as _itemgetter, eq as _eq
from keyword import iskeyword as _iskeyword
import sys as _sys
@@ -16,7 +15,18 @@ from _weakref import proxy as _proxy
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
from reprlib import recursive_repr as _recursive_repr
-MutableSequence.register(deque)
+try:
+ from _collections import deque
+except ImportError:
+ pass
+else:
+ MutableSequence.register(deque)
+
+try:
+ from _collections import defaultdict
+except ImportError:
+ pass
+
################################################################################
### OrderedDict
@@ -264,6 +274,13 @@ class OrderedDict(dict):
return dict.__eq__(self, other)
+try:
+ from _collections import OrderedDict
+except ImportError:
+ # Leave the pure Python version in place.
+ pass
+
+
################################################################################
### namedtuple
################################################################################