[New-bugs-announce] [issue46027] email.utils.parsedate_to_datetime() handling of -0000 offset

Fred Drake report at bugs.python.org
Thu Dec 9 13:12:25 EST 2021


New submission from Fred Drake <fdrake at gmail.com>:

A local time offset of '-0000' is not handled the same way as an offset of '+0000', but I'd expect it would be:

>>> import email.utils
>>> 
>>> email.utils.parsedate_to_datetime('9 Dec 2021 08:52:04 -0000')
datetime.datetime(2021, 12, 9, 8, 52, 4)
>>> email.utils.parsedate_to_datetime('9 Dec 2021 08:52:04 +0000')
datetime.datetime(2021, 12, 9, 8, 52, 4, tzinfo=datetime.timezone.utc)

I observe the same behavior on Python 3.9.9 and 3.10.1.

----------
components: email
messages: 408149
nosy: barry, fdrake, r.david.murray
priority: normal
severity: normal
status: open
title: email.utils.parsedate_to_datetime() handling of -0000 offset
type: behavior
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46027>
_______________________________________


More information about the New-bugs-announce mailing list