mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Creating an array with a bytes object as initializer
should treat the bytes as it treats a string. Not doing this broke re.compile() of big charsets.
This commit is contained in:
parent
166746c142
commit
6b826abc70
3 changed files with 8 additions and 1 deletions
|
@ -1789,6 +1789,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
return NULL;
|
||||
|
||||
if (!(initial == NULL || PyList_Check(initial)
|
||||
|| PyBytes_Check(initial)
|
||||
|| PyString_Check(initial) || PyTuple_Check(initial)
|
||||
|| (c == 'u' && PyUnicode_Check(initial)))) {
|
||||
it = PyObject_GetIter(initial);
|
||||
|
@ -1832,7 +1833,8 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
Py_DECREF(v);
|
||||
}
|
||||
} else if (initial != NULL && PyString_Check(initial)) {
|
||||
} else if (initial != NULL &&
|
||||
(PyString_Check(initial) || PyBytes_Check(initial))) {
|
||||
PyObject *t_initial, *v;
|
||||
t_initial = PyTuple_Pack(1, initial);
|
||||
if (t_initial == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue