cpython/Misc/NEWS.d/next
Georges Toth 303aac8c56
bpo-30681: Support invalid date format or value in email Date header (GH-22090)
I am re-submitting an older PR which was abandoned but is still relevant, #10783 by @timb07.

The issue being solved () is still relevant. The original PR #10783 was closed as
the final request changes were not applied and since abandoned.

In this new PR I have re-used the original patch plus applied both comments from the review, by @maxking and @pganssle.


For reference, here is the original PR description:
In email.utils.parsedate_to_datetime(), a failure to parse the date, or invalid date components (such as hour outside 0..23) raises an exception. Document this behaviour, and add tests to test_email/test_utils.py to confirm this behaviour.

In email.headerregistry.DateHeader.parse(), check when parsedate_to_datetime() raises an exception and add a new defect InvalidDateDefect; preserve the invalid value as the string value of the header, but set the datetime attribute to None.

Add tests to test_email/test_headerregistry.py to confirm this behaviour; also added test to test_email/test_inversion.py to confirm emails with such defective date headers round trip successfully.

This pull request incorporates feedback gratefully received from @bitdancer, @brettcannon, @Mariatta and @warsaw, and replaces the earlier PR #2254.

Automerge-Triggered-By: GH:warsaw
2020-10-26 17:31:06 -07:00
..
Build bpo-38980: Add -fno-semantic-interposition when building with optimizations (GH-22862) 2020-10-21 22:46:52 +01:00
C API bpo-42157: unicodedata avoids references to UCD_Type (GH-22990) 2020-10-26 19:19:36 +01:00
Core and Builtins bpo-42123: Run the parser two times and only enable invalid rules on the second run (GH-22111) 2020-10-27 00:42:04 +02:00
Documentation bpo-39416: Document some restrictions on the default string representations of numeric classes (GH-18111) 2020-10-21 10:13:50 -07:00
IDLE bpo-33987: Add master ttk Frame to IDLE search dialogs (GH-22942) 2020-10-24 23:14:02 -04:00
Library bpo-30681: Support invalid date format or value in email Date header (GH-22090) 2020-10-26 17:31:06 -07:00
Security bpo-42051: Reject XML entity declarations in plist files (#22760) 2020-10-19 20:13:49 +02:00
Tests bpo-41739: Fix test_logging.test_race_between_set_target_and_flush() (GH-22655) 2020-10-12 00:37:20 +02:00
Tools-Demos Consolidate 3.9.0b1 NEWS in the master branch 2020-05-19 13:33:08 +02:00
Windows bpo-38439: Update the Windows Store package's icons for IDLE. Artwork by Andrew Clover (GH-22817) 2020-10-20 15:54:13 +01:00
macOS bpo-41471: Ignore invalid prefix lengths in system proxy settings on macOS (GH-22762) 2020-10-19 20:16:21 +02:00