You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 that fromtimestamp 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.
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.
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: