This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author msapiro
Recipients barry, msapiro, r.david.murray
Date 2021-12-08.04:32:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638937977.72.0.569168452456.issue46011@roundup.psfhosted.org>
In-reply-to
Content
Here is an interactive Python session
```
Python 3.10.1 (main, Dec  7 2021, 15:44:39) [GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from email import message_from_bytes, policy
>>> msg_raw = b"""Return-Path: <owner-mailman-users@python.org>
... Delivered-To: mailman-users@dinsdale.python.org
... From: user@example.com
... Message-Id: <msg1>
... Date: Tue, 30 Nov 1999 23:56:33 -3000 (CST)
... To: mailman-users@python.org
... 
... msg1
... """
>>> message = message_from_bytes(msg_raw, policy=policy.default)
>>> message.get('date')
'Tue, 30 Nov 1999 23:56:33 -3000 (CST)'
>>> message.defects
[]
>>> 
```
The same session in Python 3.9 throws ValueError: offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24), not datetime.timedelta(days=-2, seconds=64800).

At first I thought this was related to https://bugs.python.org/issue30681 but that seems to not be the case as utils.parsedate_to_datetime('Tue, 30 Nov 1999 23:56:33 -3000 (CST)') throws the same exception In Python 3.10.1.

I think getting the Date: header which has an invalid timezone should either throw the exception as before or return None, but not return the invalid date header.
History
Date User Action Args
2021-12-08 04:32:57msapirosetrecipients: + msapiro, barry, r.david.murray
2021-12-08 04:32:57msapirosetmessageid: <1638937977.72.0.569168452456.issue46011@roundup.psfhosted.org>
2021-12-08 04:32:57msapirolinkissue46011 messages
2021-12-08 04:32:57msapirocreate