diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2013-10-02 12:31:47 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2013-10-02 12:31:47 (GMT) |
commit | 45163ccce42ddf7840188c0c91e66ceeb28f0e58 (patch) | |
tree | 63292c13f5447216d111321623af0dbd75c24d24 /Lib | |
parent | a0f169cde878f08c2873b0cdf42118439113a96f (diff) | |
download | cpython-45163ccce42ddf7840188c0c91e66ceeb28f0e58.zip cpython-45163ccce42ddf7840188c0c91e66ceeb28f0e58.tar.gz cpython-45163ccce42ddf7840188c0c91e66ceeb28f0e58.tar.bz2 |
Close #18690: register memoryview with Sequence ABC
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/collections/abc.py | 1 | ||||
-rw-r--r-- | Lib/test/test_collections.py | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/Lib/collections/abc.py b/Lib/collections/abc.py index a8681ea..d19e592 100644 --- a/Lib/collections/abc.py +++ b/Lib/collections/abc.py @@ -643,6 +643,7 @@ class Sequence(Sized, Iterable, Container): Sequence.register(tuple) Sequence.register(str) Sequence.register(range) +Sequence.register(memoryview) class ByteString(Sequence): diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 706cc9e..6c733ee 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -782,6 +782,8 @@ class TestCollectionABCs(ABCTestCase): self.assertTrue(issubclass(sample, Sequence)) self.assertIsInstance(range(10), Sequence) self.assertTrue(issubclass(range, Sequence)) + self.assertIsInstance(memoryview(b""), Sequence) + self.assertTrue(issubclass(memoryview, Sequence)) self.assertTrue(issubclass(str, Sequence)) self.validate_abstract_methods(Sequence, '__contains__', '__iter__', '__len__', '__getitem__') |