summaryrefslogtreecommitdiffstats
path: root/Objects/enumobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-02-07 02:45:22 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-02-07 02:45:22 (GMT)
commitc058fd14a9abdffff4f65ebd87a042fad6e68a2e (patch)
tree41f0a0e596a48de87bd46fab96b07de585a45380 /Objects/enumobject.c
parentb5ba8d749d66403edab1eaf9f3f83006134c0a67 (diff)
downloadcpython-c058fd14a9abdffff4f65ebd87a042fad6e68a2e.zip
cpython-c058fd14a9abdffff4f65ebd87a042fad6e68a2e.tar.gz
cpython-c058fd14a9abdffff4f65ebd87a042fad6e68a2e.tar.bz2
* Fix ref counting in extend() and extendleft().
* Let deques support reversed().
Diffstat (limited to 'Objects/enumobject.c')
-rw-r--r--Objects/enumobject.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/enumobject.c b/Objects/enumobject.c
index 8b2e6e1..7ed58da 100644
--- a/Objects/enumobject.c
+++ b/Objects/enumobject.c
@@ -174,8 +174,7 @@ reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (!PyArg_UnpackTuple(args, "reversed", 1, 1, &seq))
return NULL;
- /* Special case optimization for xrange and lists */
- if (PyRange_Check(seq) || PyList_Check(seq))
+ if (PyObject_HasAttrString(seq, "__reversed__"))
return PyObject_CallMethod(seq, "__reversed__", NULL);
if (!PySequence_Check(seq)) {