Author: brett.cannon Date: Wed Sep 20 20:43:13 2006 New Revision: 51927 Modified: python/trunk/Misc/NEWS python/trunk/Objects/exceptions.c Log: Allow exceptions to be directly sliced again (e.g., ``BaseException(1,2,3)[0:2]``). Discovered in Python 2.5.0 by Thomas Heller and reported to python-dev. This should be backported to 2.5 . Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Sep 20 20:43:13 2006 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Allow exception instances to be directly sliced again. + - Bug #1551432: Exceptions do not define an explicit __unicode__ method. This allows calling unicode() on exceptions classes directly to succeed. Modified: python/trunk/Objects/exceptions.c ============================================================================== --- python/trunk/Objects/exceptions.c (original) +++ python/trunk/Objects/exceptions.c Wed Sep 20 20:43:13 2006 @@ -190,12 +190,19 @@ 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; */
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4