diff options
author | Thomas Wouters <thomas@python.org> | 2007-08-30 22:57:53 +0000 |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2007-08-30 22:57:53 +0000 |
commit | d2cf20eea2338a0369d4a5707adb01b201f7dfb2 (patch) | |
tree | 59fd4a094906997ae2b0cd520ff09010457da680 /Objects/unicodeobject.c | |
parent | 582b5866174d20f7c027cbb6fb757fefb382f96f (diff) | |
download | cpython-git-d2cf20eea2338a0369d4a5707adb01b201f7dfb2.tar.gz |
Remove the simple slicing API. All slicing is now done with slice objects.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 208bc88636..f9d3068edf 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -7502,28 +7502,6 @@ unicode_rjust(PyUnicodeObject *self, PyObject *args) return (PyObject*) pad(self, width - self->length, 0, fillchar); } -static PyObject* -unicode_slice(PyUnicodeObject *self, Py_ssize_t start, Py_ssize_t end) -{ - /* standard clamping */ - if (start < 0) - start = 0; - if (end < 0) - end = 0; - if (end > self->length) - end = self->length; - if (start == 0 && end == self->length && PyUnicode_CheckExact(self)) { - /* full slice, return original string */ - Py_INCREF(self); - return (PyObject*) self; - } - if (start > end) - start = end; - /* copy slice */ - return (PyObject*) PyUnicode_FromUnicode(self->str + start, - end - start); -} - PyObject *PyUnicode_Split(PyObject *s, PyObject *sep, Py_ssize_t maxsplit) @@ -8039,7 +8017,7 @@ static PySequenceMethods unicode_as_sequence = { PyUnicode_Concat, /* sq_concat */ (ssizeargfunc) unicode_repeat, /* sq_repeat */ (ssizeargfunc) unicode_getitem, /* sq_item */ - (ssizessizeargfunc) unicode_slice, /* sq_slice */ + 0, /* sq_slice */ 0, /* sq_ass_item */ 0, /* sq_ass_slice */ PyUnicode_Contains, /* sq_contains */ |