plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
257 stars 194 forks source link

`email.utils.getaddresses` was changed to "strict-parsing" in Python 3.11.10 and 3.12.6 #4020

Closed petschki closed 1 month ago

petschki commented 1 month ago

when running the tests we've encountered the following error in testvalidateSingleEmailAddress

AssertionError: True is not false : user@example.org
Bcc: user@example.org should fail

this is because email.utils.getaddresses has changed its strategy to "strict parsing" in the newest Python 3.11 and 3.12 versions. (see https://docs.python.org/3.12/whatsnew/3.12.html#id11 and https://docs.python.org/3.11/whatsnew/3.11.html#email)

proposed solution:

add the parameter strict=False to get the old behavior back and test with getattr(email.utils, 'supports_strict_parsing', False) if this parameter is available

new approach: respect the new output from strict parsing.

mauritsvanrees commented 1 month ago

Fix got merged. Thanks!