From: Barry Warsaw Date: Wed, 18 Dec 1996 19:32:18 +0000 (+0000) Subject: PySequence_Index(): set exception when object is not found in X-Git-Tag: v1.5a1~705 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f90eddef5d3554136623aa81a91187640bf0e92c;p=thirdparty%2FPython%2Fcpython.git PySequence_Index(): set exception when object is not found in sequence, otherwise operator.indexOf([4, 3, 2, 1], 9) would raise a SystemError! Note: it might be wise to double check all these functions. I haven't done that yet. --- diff --git a/Objects/abstract.c b/Objects/abstract.c index a8823eb5a230..cac767fbfee6 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -912,6 +912,7 @@ PySequence_Index(s, o) if(err) return -1; if(! not_equal) return i; } + PyErr_SetString(PyExc_ValueError, "list.index(x): x not in list"); return -1; }