Mercurial > cpython-lru_cache-weakref
diff Objects/bytesobject.c @ 39631:8d71f9a6c1c3
Make bytesobject raise ValueError instead of TypeError again (thanks, Nick)
| author | Thomas Wouters <thomas@python.org> |
|---|---|
| date | Tue, 22 Aug 2006 13:41:17 +0000 |
| parents | 3674f20ac781 |
| children | 3dd61ffd049e |
line wrap: on
line diff
--- a/Objects/bytesobject.c Tue Aug 22 00:21:25 2006 +0000 +++ b/Objects/bytesobject.c Tue Aug 22 13:41:17 2006 +0000 @@ -245,7 +245,7 @@ if (PyBytes_Check(value)) return bytes_substring(self, (PyBytesObject *)value); - ival = PyNumber_AsSsize_t(value, PyExc_TypeError); + ival = PyNumber_AsSsize_t(value, PyExc_ValueError); if (ival == -1 && PyErr_Occurred()) return -1; if (ival < 0 || ival >= 256) { @@ -365,7 +365,7 @@ if (value == NULL) return bytes_setslice(self, i, i+1, NULL); - ival = PyNumber_AsSsize_t(value, PyExc_TypeError); + ival = PyNumber_AsSsize_t(value, PyExc_ValueError); if (ival == -1 && PyErr_Occurred()) return -1; @@ -448,7 +448,7 @@ } /* Is it an int? */ - count = PyNumber_AsSsize_t(arg, PyExc_TypeError); + count = PyNumber_AsSsize_t(arg, PyExc_ValueError); if (count == -1 && PyErr_Occurred()) PyErr_Clear(); else { @@ -500,7 +500,7 @@ } /* Interpret it as an int (__index__) */ - value = PyNumber_AsSsize_t(item, PyExc_TypeError); + value = PyNumber_AsSsize_t(item, PyExc_ValueError); Py_DECREF(item); if (value == -1 && PyErr_Occurred()) goto error;
