[issue46856] datetime.max conversion

2022-03-01 Thread Joris Geysens
Joris Geysens added the comment: I looked at this a bit more in detail. What happens it the following, starting in the datetime fromtimestamp fragment : converter = _time.gmtime if utc else _time.localtime y, m, d, hh, mm, ss, weekday, jday, dst = converter(t) That will call the system

[issue46856] datetime.max conversion

2022-02-25 Thread Eric V. Smith
Eric V. Smith added the comment: Probably so. You could step through the code to make sure that's what's going on. -- ___ Python tracker ___

[issue46856] datetime.max conversion

2022-02-25 Thread Joris Geysens
Joris Geysens added the comment: I see this in the python source code being tested (datetimetester.py), so I guess it is a rounding problem : # maximum timestamp: set seconds to zero to avoid rounding issues max_dt = self.theclass.max.replace(tzinfo=timezone.utc,

[issue46856] datetime.max conversion

2022-02-25 Thread Joris Geysens
Joris Geysens added the comment: a ValueError is raised : ValueError: year 1 is out of range on dt = datetime.fromtimestamp(ts, tz=timezone.utc) or dt = datetime.utcfromtimestamp(ts) -- ___ Python tracker

[issue46856] datetime.max conversion

2022-02-25 Thread Eric V. Smith
Eric V. Smith added the comment: Please show us how they fail. -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list

[issue46856] datetime.max conversion

2022-02-25 Thread Joris Geysens
New submission from Joris Geysens : Reading the documentation, I don't understand how this is not possible : # get the max utc timestamp ts = datetime.max.replace(tzinfo=timezone.utc).timestamp() # similarly ts2 = datetime(, 12, 31, 23, 59, 59, 99, tzinfo=timezone.utc).timestamp()