New submission from Hans-Peter Jansen:

An unfortunate combination of get_all and getaddresses results in a Traceback:

Traceback (most recent call last):
  File "misc/decode_from_header.py", line 17, in <module>
    print('From: %s' % email.utils.getaddresses(val))
  File "/usr/lib64/python3.4/email/utils.py", line 112, in getaddresses
    all = COMMASPACE.join(fieldvalues)
TypeError: sequence item 0: expected str instance, Header found

Here's the relevant part of it:
Content-type: text/html;charset=iso-8859-1
From: Itaú Uniclass. <comunicado.com...@atendimento.gotdns.ch>

Obviously, the From header is iso-8859-1 encoded as well, and violates RFC 2822 
as such. But making it crash in the usual combination of

    val = msg.get('from')
    email.utils.getaddresses([val])

isn't the real McCoy either..

----------
components: email
files: iso-8859-1-encoded-from-header.mail
messages: 270399
nosy: barry, frispete, r.david.murray
priority: normal
severity: normal
status: open
title: email.utils.getaddresses raises exception from erroneous message get_all 
input
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file43714/iso-8859-1-encoded-from-header.mail

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27513>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to