bpo-27513: email.utils.getaddresses() now handles Header objects (GH-… · python/cpython@9ee12cf · GitHub
Skip to content

Commit 9ee12cf

Browse files
bpo-27513: email.utils.getaddresses() now handles Header objects (GH-13797) (#27245)
getaddresses() should be able to handle a Header object if passed one. Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 89f4c34) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
1 parent 2f643b1 commit 9ee12cf

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

Lib/email/utils.py

Lines changed: 1 addition & 1 deletion

Lib/test/test_email/test_email.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,6 +3262,11 @@ def test_getaddresses_embedded_comment(self):
32623262
addrs = utils.getaddresses(['User ((nested comment)) <foo@bar.com>'])
32633263
eq(addrs[0][1], 'foo@bar.com')
32643264

3265+
def test_getaddresses_header_obj(self):
3266+
"""Test the handling of a Header object."""
3267+
addrs = utils.getaddresses([Header('Al Person <aperson@dom.ain>')])
3268+
self.assertEqual(addrs[0][1], 'aperson@dom.ain')
3269+
32653270
def test_make_msgid_collisions(self):
32663271
# Test make_msgid uniqueness, even with multiple threads
32673272
class MsgidsThread(Thread):
Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)