Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Improve datetime.fromtimestamp's error message
  • Loading branch information
aisk committed Sep 19, 2024
commit 2cf3cd8df69b8b258d687731d5587cfafc3f2c63
3 changes: 2 additions & 1 deletion Lib/_pydatetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,8 @@ def __new__(cls, year, month=None, day=None):
def fromtimestamp(cls, t):
"Construct a date from a POSIX timestamp (like time.time())."
if t is None:
raise TypeError("'NoneType' object cannot be interpreted as an integer")
raise TypeError("'NoneType' object cannot be interpreted "
"as an integer or a float")
y, m, d, hh, mm, ss, weekday, jday, dst = _time.localtime(t)
return cls(y, m, d)

Expand Down