diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py index 36aca958c76..942a72c0ce7 100644 --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -519,6 +519,7 @@ class Sequence(Sized, Iterable, Container): Sequence.register(tuple) Sequence.register(basestring) Sequence.register(buffer) +Sequence.register(xrange) class MutableSequence(Sequence): diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 4901eae8e56..9767afffc02 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -406,6 +406,9 @@ class TestCollectionABCs(ABCTestCase): self.failUnless(isinstance(sample(), Sequence)) self.failUnless(issubclass(sample, Sequence)) self.failUnless(issubclass(basestring, Sequence)) + self.failUnless(isinstance(range(10), Sequence)) + self.failUnless(issubclass(xrange, Sequence)) + self.failUnless(issubclass(str, Sequence)) self.validate_abstract_methods(Sequence, '__contains__', '__iter__', '__len__', '__getitem__')