Commit a0f169cd authored by Nick Coghlan's avatar Nick Coghlan

Close #19078: memoryview now supports reversed

Patch by Claudiu Popa
parent dff9e253
......@@ -352,6 +352,15 @@ class AbstractMemoryTests:
self.assertIs(wr(), None)
self.assertIs(L[0], b)
def test_reversed(self):
for tp in self._types:
b = tp(self._source)
m = self._view(b)
aslist = list(reversed(m.tolist()))
self.assertEqual(list(reversed(m)), aslist)
self.assertEqual(list(reversed(m)), list(m[::-1]))
# Variations on source objects for the buffer: bytes-like objects, then arrays
# with itemsize > 1.
# NOTE: support for multi-dimensional objects is unimplemented.
......
......@@ -10,6 +10,10 @@ Projected release date: 2013-10-20
Core and Builtins
-----------------
- Issue #19078: memoryview now correctly supports the reversed builtin
(Patch by Claudiu Popa)
Library
-------
......
......@@ -2402,7 +2402,7 @@ static PyMappingMethods memory_as_mapping = {
/* As sequence */
static PySequenceMethods memory_as_sequence = {
0, /* sq_length */
(lenfunc)memory_length, /* sq_length */
0, /* sq_concat */
0, /* sq_repeat */
(ssizeargfunc)memory_item, /* sq_item */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment