#8401: merge with 3.3.

This commit is contained in:
Ezio Melotti 2012-11-03 21:24:47 +02:00
commit 212843b29f
3 changed files with 27 additions and 0 deletions

View file

@ -589,6 +589,12 @@ bytearray_ass_subscript(PyByteArrayObject *self, PyObject *index, PyObject *valu
needed = 0;
}
else if (values == (PyObject *)self || !PyByteArray_Check(values)) {
if (PyNumber_Check(values) || PyUnicode_Check(values)) {
PyErr_SetString(PyExc_TypeError,
"can assign only bytes, buffers, or iterables "
"of ints in range(0, 256)");
return -1;
}
/* Make a copy and call this function recursively */
int err;
values = PyByteArray_FromObject(values);