[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2018-06-28 Thread Eryk Sun
Change by Eryk Sun : -- stage: needs patch -> patch review versions: +Python 3.7, Python 3.8 ___ Python tracker ___ ___

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2017-12-27 Thread Jerome Leclanche
Jerome Leclanche added the comment: Anything holding up the PR? Looks good at a glance, would be nice to get this landed in time for 3.7. -- nosy: +jleclanche ___ Python tracker

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2017-08-22 Thread Preston Landers
Changes by Preston Landers : -- nosy: +planders ___ Python tracker ___ ___

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2017-06-24 Thread Ammar Askar
Ammar Askar added the comment: Created a github pull request for the recommended patch along with a test: https://github.com/python/cpython/pull/2385 -- ___ Python tracker

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2017-06-24 Thread Ammar Askar
Changes by Ammar Askar : -- pull_requests: +2434 ___ Python tracker ___ ___

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2017-06-24 Thread Ammar Askar
Ammar Askar added the comment: Hey, sorry for the late response. I just ran: import datetime from dateutil.zoneinfo import get_zonefile_instance import dateutil.tz zonenames = list(get_zonefile_instance().zones) for tz in zonenames: tz = dateutil.tz.gettz(tz) for i in

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2017-06-16 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > I just ran the following script to check if there are any folds from > timestamps [0, 86399] in any timezone. Ammar, I am not sure pytz timezones support PEP 495 conventions. Can you repeat your experiment using the latest dateutil.tz or

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2017-01-03 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-30 Thread Ammar Askar
Changes by Ammar Askar : Added file: http://bugs.python.org/file46092/truncate_negatives.patch ___ Python tracker ___

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-30 Thread Ammar Askar
Ammar Askar added the comment: I've attached two patches that fix this behavior, one by simply foregoing the fold detection for this time range on windows (the patch that I'd argue is simpler and more readable) And one that truncates the passed values to local to not be negative. This one

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I think we should just clip the negative lower probe value to 0 on Windows before passing it to local(). Also, if we still care about platforms with 32-bit time_t, we should check for over/under flow *before* calling local(). --

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread Ammar Askar
Ammar Askar added the comment: I just ran the following script to check if there are any folds from timestamps [0, 86399] in any timezone. import datetime import pytz for tz in pytz.all_timezones: tz = pytz.timezone(tz) for i in range(86400): if

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread Ammar Askar
Ammar Askar added the comment: The 86,399 upperbound comes from this line (max_fold_seconds=86400): https://github.com/python/cpython/blob/master/Modules/_datetimemodule.c#L4277-L4278 The bug is introduced as part of the fold detection in this commit:

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread R. David Murray
R. David Murray added the comment: Sounds like it really is an OSError (that is, that the Windows OS is the source of the error). Whether or not we can or should do something about that is a separate question, though. -- nosy: +r.david.murray ___

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread SilentGhost
SilentGhost added the comment: Cannot reproduce this with the tip on linux -- ___ Python tracker ___ ___

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread SilentGhost
Changes by SilentGhost : -- components: +Windows nosy: +belopolsky, paul.moore, steve.dower, tim.golden, zach.ware stage: -> needs patch type: -> behavior ___ Python tracker

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread Ammar Askar
Ammar Askar added the comment: Can recreate successfully on windows, but not on linux: > C:\Python36\python.exe -c "import datetime; > datetime.datetime.fromtimestamp(42)" Traceback (most recent call last): File "", line 1, in OSError: [Errno 22] Invalid argument > C:\Python36\python.exe

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread SilentGhost
SilentGhost added the comment: This doesn't seem likely that it's anything to do with datetime, could you try reproducing it in repl? -- nosy: +SilentGhost ___ Python tracker

[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-28 Thread Pekka Klärck
New submission from Pekka Klärck: For example: E:\>py -3.6 -c "import datetime; datetime.datetime.fromtimestamp(42)" Traceback (most recent call last): File "", line 1, in OSError: [Errno 22] Invalid argument Works fine at least with Python 2.6-2.7 and 3.3-3.5. Only tested on Windows