diff options
-rw-r--r-- | Lib/test/test_enumerate.py | 5 | ||||
-rw-r--r-- | Objects/enumobject.c | 14 |
2 files changed, 2 insertions, 17 deletions
diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py index 00ecbcc..34bc71d 100644 --- a/Lib/test/test_enumerate.py +++ b/Lib/test/test_enumerate.py @@ -141,11 +141,8 @@ class TestReversed(unittest.TestCase): x = xrange(1) self.assertEqual(type(reversed(x)), type(iter(x))) - def test_double_reverse(self): - s = 'hello' - self.assertEqual(list(reversed(reversed(s))), list(s)) - def test_len(self): + # This is an implementation detail, not an interface requirement s = 'hello' self.assertEqual(len(reversed(s)), len(s)) diff --git a/Objects/enumobject.c b/Objects/enumobject.c index 55595ce..1d13123 100644 --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -236,23 +236,11 @@ reversed_len(reversedobject *ro) return PyObject_Size(ro->seq); } -static PyObject * -reversed_reverse(reversedobject *ro, PyObject *unused) -{ - return PyObject_GetIter(ro->seq); -} - PyDoc_STRVAR(reversed_doc, "reverse(sequence) -> reverse iterator over values of the sequence\n" "\n" "Return a reverse iterator"); -static PyMethodDef reversed_methods[] = { - {"__reversed__", (PyCFunction)reversed_reverse, - METH_NOARGS, reversed_doc}, - {NULL, NULL} /* sentinel */ -}; - static PySequenceMethods reversed_as_sequence = { (inquiry)reversed_len, /* sq_length */ 0, /* sq_concat */ @@ -289,7 +277,7 @@ PyTypeObject PyReversed_Type = { 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)reversed_next, /* tp_iternext */ - reversed_methods, /* tp_methods */ + 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ |