[issue46011] Python 3.10 email returns invalid Date: header unchanged.

2021-12-09 Thread R. David Murray


R. David Murray  added the comment:

Yeah, I think there may be a general issue with getting header defects 
reflected somehow in message.defects, but that's a separate issue :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46011] Python 3.10 email returns invalid Date: header unchanged.

2021-12-08 Thread Mark Sapiro


Mark Sapiro  added the comment:

Upon further research I realized this is related to 
https://bugs.python.org/issue30681 and that while there are no message.defects 
the Date: header does have the InvalidDateDefect and its datetime attribute is 
None so I consider this resolved.

--
stage:  -> resolved

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46011] Python 3.10 email returns invalid Date: header unchanged.

2021-12-07 Thread Mark Sapiro


New submission from Mark Sapiro :

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: 
... Delivered-To: mailman-us...@dinsdale.python.org
... From: u...@example.com
... Message-Id: 
... Date: Tue, 30 Nov 1999 23:56:33 -3000 (CST)
... To: mailman-us...@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.

--
components: email
keywords: 3.10regression
messages: 407997
nosy: barry, msapiro, r.david.murray
priority: normal
severity: normal
status: open
title: Python 3.10 email returns invalid Date: header unchanged.
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com