[issue21476] Inconsitent behaviour between BytesParser.parse and Parser.parse

Vajrasky Kok report at bugs.python.org
Sat May 31 18:50:26 CEST 2014


Vajrasky Kok added the comment:

The Parse class does not throw exception if given invalid message:

Assume /tmp/a.txt contains garbage, such as: "&&&&&"

With this code:

    with open("/tmp/a.txt", "r") as fp:
        msg = email.parser.Parser().parse(fp) # does not throw exception
        print(msg) # => &&&&&
        msg['from'] # => None

It is just you can not get useful information, such as msg['to'].

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21476>
_______________________________________


More information about the Python-bugs-list mailing list