-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed as not planned
Labels
3.10only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Datetime fromisoformat() not parsing string with trailing 'Z'
>>> import datetime
>>> datetime.datetime.fromisoformat('2011-11-04T00:05:23Z')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Invalid isoformat string: '2011-11-04T00:05:23Z'
>>> datetime.fromisoformat('2011-11-04T00:05:23')
datetime.datetime(2011, 11, 4, 0, 5, 23)
Environment information
user@Dell-XPS-15-9530:~$ python3
Python 3.10.14 (main, Apr 6 2024, 18:45:05) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Documentation page example and expected result:
>>>datetime.fromisoformat('2011-11-04T00:05:23')
datetime.datetime(2011, 11, 4, 0, 5, 23)
>>>datetime.fromisoformat('2011-11-04T00:05:23Z')
datetime.datetime(2011, 11, 4, 0, 5, 23, tzinfo=datetime.timezone.utc)
Testing on 3.12.8 [GCC 11.4.0] worked as expected
CPython versions tested on:
3.10
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
3.10only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error