KEMBAR78
gh-126947: Typechecking for _pydatetime.timedelta.__new__ arguments by bombs-kim · Pull Request #126949 · python/cpython · GitHub
Skip to content

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

…iDYUe.rst

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@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
…ents (python#126949)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
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