◐ Shell
clean mode source ↗

Message 158474 - Python tracker

From Eric Smith on python-dev:

> +    suffix, mode, type_ = details
> +    if mode and (not mode.startswith(('r', 'U'))) or '+' in mode:
> +        raise ValueError('invalid file open mode {!r}'.format(mode))

Should this be:
if mode and (not mode.startswith(('r', 'U')) or '+' in mode):

to match:

> -    if (*mode) {
...
> -        if (!(*mode == 'r' || *mode == 'U') || strchr(mode, '+')) {
> -            PyErr_Format(PyExc_ValueError,
> -                         "invalid file open mode %.200s", mode);