-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Inaccurate error message for datetime.datetime.fromtimestamp #111513
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
Labels
type-feature
A feature request or enhancement
Comments
I don't see any bug in this code. It appears to be a request to enhance the error message, so I'm removing the "type-bug" label and adding the "type-feature" label. |
Closed
vstinner
pushed a commit
that referenced
this issue
Sep 20, 2024
The error message was enhanced by the change 1a57772. |
savannahostrowski
pushed a commit
to savannahostrowski/cpython
that referenced
this issue
Sep 22, 2024
savannahostrowski
pushed a commit
to savannahostrowski/cpython
that referenced
this issue
Sep 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
datetime.datetime.fromtimestamp
recognizes floating point arguments, but when I mistakenly enter a string as an argument, I get the error message "TypeError: 'str' object cannot be interpreted as an integer". This error message implies thatfromtimestamp
only accepts integers, which is confusing.Expected behavior: see error message "TypeError: 'str' object cannot be interpreted as a float" or similar.
The same problem happens for
datetime.datetime.utcfromtimestamp
.CPython versions tested on:
3.11
Operating systems tested on:
macOS
Linked PRs
The text was updated successfully, but these errors were encountered: