Skip to content

Conversation

@ba-13
Copy link

@ba-13 ba-13 commented Feb 11, 2024

Issue#115225 is regarding the incorrect behavior of datetime.time.fromisoformat.

@xitop points out in ISO8601 specified that a decimal fraction may be added to the lowest-order time element present. The OP also mentions that the current docs says fractional minutes/hours are not supported, and recommends to throw ValueError.

I found the current version had tried to parse fractional quantities somewhat but incorrectly, so I opted for including fractional time element and not raising an exception. Changed Lib/_pydatetime.py and Modules/_datetimemodule.c. All datetime tests are ok.

@ghost
Copy link

ghost commented Feb 11, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Feb 11, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@pganssle
Copy link
Member

I commented in #115225, but I believe the correct approach here is to raise ValueError rather than to actually support fractional minute and hour components. Lack of support for fractional values is deliberate.

@ba-13
Copy link
Author

ba-13 commented Feb 11, 2024

@pganssle I'll change it to throw ValueError then.

@encukou
Copy link
Member

encukou commented Mar 12, 2025

This was implemented in #119339.
Apologies for not finishing the review here first.

@encukou encukou closed this Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants