summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2006-09-21 18:12:15 (GMT)
committerBrett Cannon <bcannon@gmail.com>2006-09-21 18:12:15 (GMT)
commitc70e003f75f40f0dcce1a7b7e02bebe16204c985 (patch)
tree68dddc8d2063bc53687075d0570e077cdcceaffb /Objects/exceptions.c
parent7dcdeaf1f79186a8ffd396f9d8bacebfc25724c9 (diff)
downloadcpython-c70e003f75f40f0dcce1a7b7e02bebe16204c985.zip
cpython-c70e003f75f40f0dcce1a7b7e02bebe16204c985.tar.gz
cpython-c70e003f75f40f0dcce1a7b7e02bebe16204c985.tar.bz2
Backport of fix to allow exception instances to be sliced once again.
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index fda2ab1..bfe28a9 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -190,12 +190,19 @@ BaseException_getitem(PyBaseExceptionObject *self, Py_ssize_t index)
return PySequence_GetItem(self->args, index);
}
+static PyObject *
+BaseException_getslice(PyBaseExceptionObject *self,
+ Py_ssize_t start, Py_ssize_t stop)
+{
+ return PySequence_GetSlice(self->args, start, stop);
+}
+
static PySequenceMethods BaseException_as_sequence = {
0, /* sq_length; */
0, /* sq_concat; */
0, /* sq_repeat; */
(ssizeargfunc)BaseException_getitem, /* sq_item; */
- 0, /* sq_slice; */
+ (ssizessizeargfunc)BaseException_getslice, /* sq_slice; */
0, /* sq_ass_item; */
0, /* sq_ass_slice; */
0, /* sq_contains; */