]> git.ipfire.org Git - thirdparty/babel.git/commit
Introduce invariant that _invalid_pofile() takes unicode line.
authorNiklas Hambüchen <mail@nh2.me>
Tue, 28 Jan 2020 01:46:25 +0000 (02:46 +0100)
committerNiklas Hambüchen <mail@nh2.me>
Tue, 28 Jan 2020 01:58:42 +0000 (02:58 +0100)
commitf4f6653e6aa053724d2c6dc0ee71dcb928013352
treefe3b30f503cd79d4763ab529b4f505ca65927422
parent4fa749b918810b52a63b312d82e4003e24db0406
Introduce invariant that _invalid_pofile() takes unicode line.

This makes debugging and reasoning about the code easier;
otherwise it is surprising that sometimes `line` is a unicode
and sometimes not.

So far, when it was not, it could either be only `""` or
`'Algo esta mal'`; thus this commit makes those two u"" strings.
In all other cases, it was guaranteed that it's unicode,
because all code paths leading to `_invalid_pofile()` went through

    if not isinstance(line, text_type):
        line = line.decode(self.catalog.charset)

before.
babel/messages/pofile.py
tests/messages/test_pofile.py