classification
Title: Timestamp conversion on windows fails with timestamps close to EPOCH
Type: behavior Stage: patch review
Components: Windows Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Dschoni, ammar2, belopolsky, jleclanche, malin, p-ganssle, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2019-07-09 10:32 by Dschoni, last changed 2020-01-10 12:29 by pingchaoc.

Pull Requests
URL Status Linked Edit
PR 15498 open pingchaoc, 2020-01-10 12:29
Messages (5)
msg347541 - (view) Author: Dschoni (Dschoni) Date: 2019-07-09 10:32
A long description of the issue can be found on SO here: https://stackoverflow.com/questions/56931738/python-crash-on-windows-with-a-datetime-close-to-the-epoch?noredirect=1#comment100413591_56931738

TL;DR:

This fails on windows:

from datetime import datetime
datetime.fromtimestamp(1).timestamp()
msg347596 - (view) Author: Ma Lin (malin) * Date: 2019-07-10 04:11
Looks like a similar problem to issue29097.

>>> from datetime import datetime
>>> d = datetime.fromtimestamp(1)
>>> d.timestamp()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument

Neijwiert tried to analyzed it in stackoverflow:
https://stackoverflow.com/questions/56931738/
msg355819 - (view) Author: Paul Ganssle (p-ganssle) * (Python committer) Date: 2019-11-01 14:38
This indeed seems to be a duplicate of 29097, which is fixed in Python 3.7, so we can close this bug. Thank you for your report Dschoni, and thank you for finding the duplicate Ma Lin!
msg355824 - (view) Author: Ma Lin (malin) * Date: 2019-11-01 16:09
issue29097 fixed bug in `datetime.fromtimestamp()`.
But this issue is about `datetime.timestamp()`, not fixed yet.
msg355832 - (view) Author: Paul Ganssle (p-ganssle) * (Python committer) Date: 2019-11-01 18:22
Ah, my mistake. The examples all use `datetime.fromtimestamp`, so I didn't notice that it was failing only on the `timestamp` side. Re-opening, thanks!
History
Date User Action Args
2020-06-17 19:13:55SilentGhostlinkissue40997 superseder
2020-01-10 12:29:05pingchaocsetkeywords: + patch
stage: resolved -> patch review
pull_requests: + pull_request17343
2019-11-01 18:22:28p-gansslesetstatus: closed -> open
superseder: [Windows] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6 ->
resolution: duplicate ->
messages: + msg355832
2019-11-01 16:09:01malinsetmessages: + msg355824
2019-11-01 14:40:49p-ganssleunlinkissue38233 superseder
2019-11-01 14:38:58p-gansslesetstatus: open -> closed
superseder: [Windows] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6
messages: + msg355819

resolution: duplicate
stage: resolved
2019-09-20 15:45:48ammar2linkissue38233 superseder
2019-07-10 04:14:41xtreaksetnosy: + p-ganssle
2019-07-10 04:11:11malinsetnosy: + belopolsky, jleclanche, malin, ammar2

messages: + msg347596
versions: + Python 3.8, Python 3.9
2019-07-09 10:32:25Dschonicreate