mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
#8401: merge with 3.3.
This commit is contained in:
commit
212843b29f
3 changed files with 27 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue