diff options
author | Marc-André Lemburg <mal@egenix.com> | 2006-08-14 12:57:27 (GMT) |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2006-08-14 12:57:27 (GMT) |
commit | 3a457790c7be631765dd84948e7415e396bc4ea8 (patch) | |
tree | 837fa65c7e6e0606c49eba8a9a46eae1a030efb1 /Objects/unicodeobject.c | |
parent | 4873fb2bacb0bd34c38302d8969e5cc418d9f99e (diff) | |
download | cpython-3a457790c7be631765dd84948e7415e396bc4ea8.zip cpython-3a457790c7be631765dd84948e7415e396bc4ea8.tar.gz cpython-3a457790c7be631765dd84948e7415e396bc4ea8.tar.bz2 |
Correct an accidentally removed previous patch.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index f4e3755..d93f780 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -7061,14 +7061,11 @@ static PySequenceMethods unicode_as_sequence = { PyUnicode_Contains, /* sq_contains */ }; -#define HASINDEX(o) PyType_HasFeature((o)->ob_type, Py_TPFLAGS_HAVE_INDEX) - static PyObject* unicode_subscript(PyUnicodeObject* self, PyObject* item) { - PyNumberMethods *nb = item->ob_type->tp_as_number; - if (nb != NULL && HASINDEX(item) && nb->nb_index != NULL) { - Py_ssize_t i = nb->nb_index(item); + if (PyIndex_Check(item)) { + Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); if (i == -1 && PyErr_Occurred()) return NULL; if (i < 0) |