Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 23863:dfa68668d00e legacy-trunk
Now FOR_LOOP is gone, loop_subscript can go too.
make -s rules :-)
| author | Michael W. Hudson <mwh@python.net> |
|---|---|
| date | Fri, 14 Jun 2002 13:53:29 +0000 |
| parents | e4272ad1a636 |
| children | a2bcb00dcbd5 |
line wrap: on
line diff
--- a/Python/ceval.c Fri Jun 14 13:48:25 2002 +0000 +++ b/Python/ceval.c Fri Jun 14 13:53:29 2002 +0000 @@ -51,7 +51,6 @@ static void call_trace_protected(Py_tracefunc, PyObject *, PyFrameObject *, int); static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); -static PyObject *loop_subscript(PyObject *, PyObject *); static PyObject *apply_slice(PyObject *, PyObject *, PyObject *); static int assign_slice(PyObject *, PyObject *, PyObject *, PyObject *); @@ -3303,24 +3302,6 @@ #define SLICE_ERROR_MSG \ "standard sequence type does not support step size other than one" -static PyObject * -loop_subscript(PyObject *v, PyObject *w) -{ - PySequenceMethods *sq = v->ob_type->tp_as_sequence; - int i; - if (sq == NULL || sq->sq_item == NULL) { - PyErr_SetString(PyExc_TypeError, "loop over non-sequence"); - return NULL; - } - i = PyInt_AsLong(w); - v = (*sq->sq_item)(v, i); - if (v) - return v; - if (PyErr_ExceptionMatches(PyExc_IndexError)) - PyErr_Clear(); - return NULL; -} - /* Extract a slice index from a PyInt or PyLong, and store in *pi. Silently reduce values larger than INT_MAX to INT_MAX, and silently boost values less than -INT_MAX to 0. Return 0 on error, 1 on success.
