[New-bugs-announce] [issue36439] [Windows] datetime.fromtimestamp(t) when t < 0 fails on Python 3.6

Mickaël Schoentgen report at bugs.python.org
Tue Mar 26 11:18:26 EDT 2019


New submission from Mickaël Schoentgen <contact at tiger-222.fr>:

A similar issue was resolved with issue29097 (with 0 <= t <= 86399).

Here, we have an inconsistency between OSes when using datetime.fromtimestamp(t) when t < 0.
Tested on Python 3.6.7.

GNU/Linux:

>>> datetime.fromtimestamp(-1)
datetime.datetime(1970, 1, 1, 0, 59, 59)

macOS:

>>> datetime.fromtimestamp(-1)
datetime.datetime(1970, 1, 1, 0, 59, 59)

Windows (7 and 10):

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


I think having a similar behavior between all Oses would be great, right?

----------
messages: 338893
nosy: Tiger-222
priority: normal
severity: normal
status: open
title: [Windows] datetime.fromtimestamp(t) when t < 0 fails on Python 3.6
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36439>
_______________________________________


More information about the New-bugs-announce mailing list