summaryrefslogtreecommitdiffstats
path: root/Objects/bytearrayobject.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-07-16 23:17:46 (GMT)
committerGeorg Brandl <georg@python.org>2008-07-16 23:17:46 (GMT)
commit3238a3e3297fd691cde3b73bbe066f60f56c018f (patch)
tree405efb619e2e37f4ccbe0365fc2ca6f8b521f42e /Objects/bytearrayobject.c
parent3e75846cf60218db698c9046ac3ae2632403f141 (diff)
downloadcpython-3238a3e3297fd691cde3b73bbe066f60f56c018f.zip
cpython-3238a3e3297fd691cde3b73bbe066f60f56c018f.tar.gz
cpython-3238a3e3297fd691cde3b73bbe066f60f56c018f.tar.bz2
Backport part of r65043.
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r--Objects/bytearrayobject.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 31b5804..e31b7d5 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -55,10 +55,9 @@ _getbytevalue(PyObject* arg, int *value)
face_value = PyLong_AsLong(index);
Py_DECREF(index);
}
- if (face_value == -1 && PyErr_Occurred())
- return 0;
if (face_value < 0 || face_value >= 256) {
+ /* this includes the OverflowError in case the long is too large */
PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)");
return 0;
}