summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-08-22 13:41:17 (GMT)
committerThomas Wouters <thomas@python.org>2006-08-22 13:41:17 (GMT)
commitd204a715f4776fc2e5498e81c9e7a647e902b682 (patch)
treefd0fdb62b9df60800d49ccf610d907870c789fa1 /Objects
parent89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c (diff)
downloadcpython-d204a715f4776fc2e5498e81c9e7a647e902b682.zip
cpython-d204a715f4776fc2e5498e81c9e7a647e902b682.tar.gz
cpython-d204a715f4776fc2e5498e81c9e7a647e902b682.tar.bz2
Make bytesobject raise ValueError instead of TypeError again (thanks, Nick)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bytesobject.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 241281e..d6cce6d 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -245,7 +245,7 @@ bytes_contains(PyBytesObject *self, PyObject *value)
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 @@ bytes_setitem(PyBytesObject *self, Py_ssize_t i, PyObject *value)
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 @@ bytes_init(PyBytesObject *self, PyObject *args, PyObject *kwds)
}
/* 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 @@ bytes_init(PyBytesObject *self, PyObject *args, PyObject *kwds)
}
/* 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;