https://github.com/python/cpython/commit/080fc54a165eb57750ba275cac57beb353c563d1
commit: 080fc54a165eb57750ba275cac57beb353c563d1
branch: main
author: Jelle Zijlstra <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2026-10-21T19:10:45Z
summary:

gh-159739: Avoid quadratic grouped-address parsing (#159990)

files:
A Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.35942a.rst
M Lib/email/_parseaddr.py

diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py
index e311948cb09a7d6..29718957a68a9be 100644
--- a/Lib/email/_parseaddr.py
+++ b/Lib/email/_parseaddr.py
@@ -307,7 +307,7 @@ def getaddress(self):
                 if self.pos < fieldlen and self.field[self.pos] == ';':
                     self.pos += 1
                     break
-                returnlist = returnlist + self.getaddress()
+                returnlist.extend(self.getaddress())
 
         elif self.field[self.pos] == '<':
             # Address is a phrase then a route addr
diff --git 
a/Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.35942a.rst 
b/Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.35942a.rst
new file mode 100644
index 000000000000000..548ac837589f078
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.35942a.rst
@@ -0,0 +1 @@
+Improve performance when parsing email address groups with many members.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to