Mercurial > cpython-lru_cache-weakref
diff Modules/arraymodule.c @ 42145:8eeaa9923901
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 03 Jul 2007 16:22:09 +0000 |
| parents | 1f7b66a9ffb0 |
| children | d0719406b2c6 |
line wrap: on
line diff
--- a/Modules/arraymodule.c Tue Jul 03 15:39:16 2007 +0000 +++ b/Modules/arraymodule.c Tue Jul 03 16:22:09 2007 +0000 @@ -1789,6 +1789,7 @@ 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 @@ } 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) {
