Skip to content

gh-126947: Typechecking for _pydatetime.timedelta.__new__ arguments #126949

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

Merged
merged 5 commits into from
Nov 19, 2024

Conversation

bombs-kim
Copy link
Contributor

@bombs-kim bombs-kim commented Nov 18, 2024

  • Add typecheck in _pydatetime.timedelta so that same format error is raised as in _datetime.timedelta
  • Add relevant tests for the new typecheck in datetime module

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Now python implementation is in line with C implementation. Please, add a NEWS entry.

@bombs-kim
Copy link
Contributor Author

@sobolevn a NEWS entry has been added

@sobolevn
Copy link
Member

Thanks! Let's wait for code-owners to review :)

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM. The PR doesn't change the exception type, but provides a better error message.

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

I might as well hop on the approval train :)

How do we feel about backporting?

@vstinner
Copy link
Member

How do we feel about backporting?

It's a bad idea to change error messages in a stable release, it can break tests.

@sobolevn sobolevn merged commit 8da9920 into python:main Nov 19, 2024
40 checks passed
@sobolevn
Copy link
Member

Thanks everyone!

ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
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.

5 participants