Repository navigation
Error in example of datetime.time.fromisoformat #112925
Copy link
Copy link
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesdocsDocumentation in the Doc dirDocumentation in the Doc direasytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
Thanks for the report.
Looks like a copy/paste error from the previous example:
>>> time.fromisoformat('04:23:01.000384') datetime.time(4, 23, 1, 384) >>> time.fromisoformat('04:23:01,000') datetime.time(4, 23, 1, 384)
The actual output (Python 3.11.7 and 3.12.1):
>>> from datetime import time >>> time.fromisoformat('04:23:01.000384') datetime.time(4, 23, 1, 384) >>> time.fromisoformat('04:23:01,000') datetime.time(4, 23, 1)
Would you like to open a PR to fix it?
It would also be a good idea to add the doctest marker so these examples are actually tested.
See
.. doctest::elsewhere in the file.Reacted by Kirill Podoprigora- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixes
on Dec 10, 2023 - added a commit that references this issue
on Dec 23, 2023 Thank you for your contribution @F-park.
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesdocsDocumentation in the Doc dirDocumentation in the Doc direasytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Documentation
cpython/Doc/library/datetime.rst
Lines 1811 to 1812 in 5bf7580
I consider the correct example should be below.
>>> time.fromisoformat('04:23:01,000384') datetime.time(4, 23, 1, 384)python docs version
Linked PRs
datetime.time.fromisoformatand add doctest marker #112931datetime.time.fromisoformatand add doctest marker (GH-112931) #113427datetime.time.fromisoformatand add doctest marker (GH-112931) #113428