]> granicus.if.org Git - python/commit
[3.6] bpo-29097: Forego fold detection on windows for low timestamp values (GH-2385...
authorAmmar Askar <ammar_askar@hotmail.com>
Fri, 27 Jul 2018 14:59:27 +0000 (07:59 -0700)
committerAlexander Belopolsky <abalkin@users.noreply.github.com>
Fri, 27 Jul 2018 14:59:27 +0000 (10:59 -0400)
commit6ea8a3a0ebf840ca57b6dba9cad26fbb0ddaa5d4
tree95cbb72d7f8bd24ed85aa777bfda2e7f157ae397
parent777cdd94b9bebd5b22df0fc293aa078d5537b988
[3.6] bpo-29097: Forego fold detection on windows for low timestamp values (GH-2385) (GH-8498)

On Windows, passing a negative value to local results in an OSError because localtime_s on Windows does not support negative timestamps. Unfortunately this means that fold detection for timestamps between 0 and max_fold_seconds will result in this OSError since we subtract max_fold_seconds from the timestamp to detect a fold. However, since we know there haven't been any folds in the interval [0, max_fold_seconds) in any timezone, we can hackily just forego fold detection for this time range on Windows..
(cherry picked from commit 96d1e69a12ed8ab80203277e1abdaf573457a964)

Co-authored-by: Ammar Askar <ammar_askar@hotmail.com>
Lib/datetime.py
Lib/test/datetimetester.py
Misc/NEWS.d/next/Windows/2018-05-16-11-31-17.bpo-29097.9mqEuI.rst [new file with mode: 0644]
Modules/_datetimemodule.c