New submission from Sebastian Kreft: The return type of email.header.decode_header is not consistent. When there are encoded parts the return type is a list of (bytes, charset or None) (Note that the documentation says it is a list of (str, charset)). However, when there are no encoded parts the return type is [(str, None)]. Note that, at the end of the function, there is a routine that converts everything to bytes.
Compare: In [01]: email.header.decode_header('=?UTF-8?Q?foo?=bar') Out[01]: [(b'foo', 'utf-8'), (b'bar', None)] In [02]: email.header.decode_header('foobar') Out[02]: [('foobar', None)] ---------- messages: 248047 nosy: Sebastian Kreft priority: normal severity: normal status: open title: email.header.decode_header return type is not consistent versions: Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24797> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com