Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make PyTimeAccess::get_fold() return bool instead of u8 #1397

Merged
merged 1 commit into from Feb 14, 2021

Conversation

kangalio
Copy link
Contributor

The fold property of a Python datetime stores whether the datetime lies on a leap second or not. The only allowed values are 0 and 1 (source). Therefore, the PyTimeAccess::get_fold() method should expose this property as a bool.

Coincidentally, the PyTime::new_with_fold() already uses bool as the type of fold.

In a later PR, I will add the currently missing PyDateTime::new_with_fold() method, which is also going to accept bool for the fold parameter.

This is a breaking change

Copy link
Member

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, sounds reasonable to me.

This is a breaking change

Then let's add a CHANGELOG entry

Comment on lines 228 to 229
// TODO: Python's fold values must be either 0 or 1 as per Python documentation. Should we
// panic if they do, for whatever reason, fall outside that range?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should cause panic here.

@davidhewitt
Copy link
Member

As this is another breaking change, I'm thinking it's time to release 0.13.2 before we then start merging all changes for 0.14 . Will put a PR for this out tonight.

@davidhewitt
Copy link
Member

I'm rebasing and merging this shortly. Thanks again!

@davidhewitt davidhewitt force-pushed the get_fold_bool branch 2 times, most recently from 0665222 to 87ee51f Compare February 14, 2021 08:26
@davidhewitt davidhewitt merged commit 442a04e into PyO3:master Feb 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants