NB: as you asked for it, I think there is no possible timestamp that will throw the specific exception you are looking for, because datetime.fromtimestamp will raise a ValueError , since it is bound (possibly) by the same limits.
Now ranges for mktime are platform dependent, so I cannot give you a specific answer. On my 32-bit Linux computer, the boundaries are enclosed in a 32-bit integer, so the tuple that translates to a value less than -2147483648 (i.e., Before (1901, 12, 13, 19, 44, 16) ) or in the past 2147483647 , or (2038, 1, 19, 3, 14, 7) , raises this exception ... but again, for you, datetime.fromtimestamp will catch it earlier.
source share