Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 3863:4566a19c3438 legacy-trunk
Better error message if stride used on normal sequence object
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 30 Jul 1996 18:40:29 +0000 |
| parents | 22e29b1747e1 |
| children | 138fa15a1032 |
line wrap: on
line diff
--- a/Python/ceval.c Tue Jul 30 18:37:55 1996 +0000 +++ b/Python/ceval.c Tue Jul 30 18:40:29 1996 +0000 @@ -2529,6 +2529,9 @@ return result; } +#define SLICE_ERROR_MSG \ + "standard sequence type does not support step size other than one" + static object * apply_subscript(v, w) object *v, *w; @@ -2543,8 +2546,13 @@ } else { int i; - if (!is_intobject(w)) { - err_setstr(TypeError, "sequence subscript not int"); + if (!is_intobject(w)) { + if (PySlice_Check(w)) { + err_setstr(ValueError, SLICE_ERROR_MSG); + } else { + err_setstr(TypeError, + "sequence subscript not int"); + } return NULL; } i = getintvalue(w);
