msg301143 - (view) |
Author: Jerry Kramskoy (jerrykramskoy) |
Date: 2017-09-01 17:24 |
Running python 3.6.2 on Windows 10.
The following method causes presents a timetstamp value of -3600 (i.e. DST adjustment of one hour) which causes time.localtime() to raise an OS Errno 22.
def _naive_is_dst(self, dt):
timestamp = _datetime_to_timestamp(dt)
return time.localtime(timestamp + time.timezone).tm_isdst
Reproduce with python shell...
import time
z=time.localtime(-3600)
Traceback (most recent call last):
Python Shell, prompt 7, line 1
builtins.OSError: [Errno 22] Invalid argument
The documentation doesn't specify a legal value range for input to localtime.
Unfortunately,this causes AWS boto3 support for dynamodb to crash.
Cheers, Jerry
|
msg301219 - (view) |
Author: Louie Lu (louielu) * |
Date: 2017-09-04 12:46 |
Using macOS and Linux can't reproduce this problem, both platform
return this output:
>>> import time
>>> time.localtime(-3600)
time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=7, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)
|
msg304152 - (view) |
Author: Stéphane Wirtel (matrixise) * |
Date: 2017-10-11 15:39 |
Hi Steve, I have added you on this issue because it's related to Windows.
Maybe you could check it.
|
msg304154 - (view) |
Author: Tim Peters (tim.peters) * |
Date: 2017-10-11 15:48 |
The docs for the `time` module say:
"""
Although this module is always available, not all functions are available on all platforms. Most of the functions defined in this module call platform C library functions with the same name. It may sometimes be helpful to consult the platform documentation, because the semantics of these functions varies among platforms.
"""
The Windows `localtime()` simply doesn't support dates before the epoch:
https://msdn.microsoft.com/en-us/library/aa246456(v=vs.60).aspx
|
msg304155 - (view) |
Author: Stéphane Wirtel (matrixise) * |
Date: 2017-10-11 16:00 |
Thank you Tim,
In this case, the documentation seems to be correct, maybe we could close this issue because it's independent of Python.
What's your opinion on this point?
Close it or Improve the documentation?
|
msg304159 - (view) |
Author: Tim Peters (tim.peters) * |
Date: 2017-10-11 16:22 |
Since this is a pretty common gotcha, I'd prefer to add it as an example to the text I already quoted; e.g., add:
"""
For example, the native Windows C libraries do not support times before the epoch, and `localtime(n)` for negative `n` raises `OSError` on Windows.
"""
|
msg304160 - (view) |
Author: Stéphane Wirtel (matrixise) * |
Date: 2017-10-11 16:24 |
Thank you, I will provide a PR for this issue and close it once it's over.
|
msg304161 - (view) |
Author: Tim Peters (tim.peters) * |
Date: 2017-10-11 16:33 |
I'll just add that it may be a different issue to argue about how `_naive_is_dst()` is implemented.
|
msg304162 - (view) |
Author: Alexander Belopolsky (belopolsky) * |
Date: 2017-10-11 16:52 |
Is this similar to issue 29097?
|
msg339018 - (view) |
Author: Stéphane Wirtel (matrixise) * |
Date: 2019-03-28 08:27 |
nosy: -matrixise
|
msg339019 - (view) |
Author: Stéphane Wirtel (matrixise) * |
Date: 2019-03-28 08:28 |
----------
nosy: -matrixise
|
msg339020 - (view) |
Author: Stéphane Wirtel (matrixise) * |
Date: 2019-03-28 08:29 |
sorry for the spam, I wanted to be removed from the noisy list via the mail gateway but my two tests did not work :/
|
msg339042 - (view) |
Author: Paul Ganssle (p-ganssle) * |
Date: 2019-03-28 13:52 |
Can we change the title of this to something like, "Add example of platform-specific support for negative timestamps to the time documentation"?
That might be a bit wordy, but as it is now, this looks like it's reporting a bug in dateutil, which is not part of the standard library, which may be confusing people looking for something to solve.
As for the meat of the documentation change, I think we can adapt the wording from `datetime.fromtimestamp`, which actually has a very similar example called out: https://docs.python.org/3.7/library/datetime.html#datetime.datetime.fromtimestamp
> fromtimestamp() may raise OverflowError, if the timestamp is out of the range of values supported by the platform C localtime() or gmtime() functions, and OSError on localtime() or gmtime() failure. It’s common for this to be restricted to years in 1970 through 2038.
|
msg413754 - (view) |
Author: Vidhya (vidhya) * |
Date: 2022-02-22 23:03 |
[Entry level contributor seeking guidance]If this is not yet fixed, I can work on this. Please let me know.
|
msg414931 - (view) |
Author: miss-islington (miss-islington) |
Date: 2022-03-11 19:05 |
New changeset c83fc9c02c9846ec3a2d0123999c98e02f00b3f5 by slateny in branch 'main':
bpo-31327: Update time documentation to reflect possible errors (GH-31460)
https://github.com/python/cpython/commit/c83fc9c02c9846ec3a2d0123999c98e02f00b3f5
|
msg414933 - (view) |
Author: miss-islington (miss-islington) |
Date: 2022-03-11 19:28 |
New changeset 30d80213ae305bd0f0ed6bec7a0dff3e97b1c321 by Miss Islington (bot) in branch '3.9':
bpo-31327: Update time documentation to reflect possible errors (GH-31460)
https://github.com/python/cpython/commit/30d80213ae305bd0f0ed6bec7a0dff3e97b1c321
|
msg414934 - (view) |
Author: miss-islington (miss-islington) |
Date: 2022-03-11 19:29 |
New changeset b35b36e106152245fe68880f4073fd99ec17f65d by Miss Islington (bot) in branch '3.10':
bpo-31327: Update time documentation to reflect possible errors (GH-31460)
https://github.com/python/cpython/commit/b35b36e106152245fe68880f4073fd99ec17f65d
|
msg415332 - (view) |
Author: Łukasz Langa (lukasz.langa) * |
Date: 2022-03-16 10:12 |
New changeset 4d8e08b21ce5d2cc08da82cf9f3ca50d9617cbdc by Miss Islington (bot) in branch '3.8':
bpo-31327: Update time documentation to reflect possible errors (GH-31460) (GH-31827)
https://github.com/python/cpython/commit/4d8e08b21ce5d2cc08da82cf9f3ca50d9617cbdc
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:51 | admin | set | github: 75508 |
2022-03-16 10:23:07 | iritkatriel | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
2022-03-16 10:12:59 | lukasz.langa | set | nosy:
+ lukasz.langa messages:
+ msg415332
|
2022-03-11 19:29:55 | miss-islington | set | messages:
+ msg414934 |
2022-03-11 19:28:47 | miss-islington | set | messages:
+ msg414933 |
2022-03-11 19:06:22 | miss-islington | set | pull_requests:
+ pull_request29924 |
2022-03-11 19:06:17 | miss-islington | set | pull_requests:
+ pull_request29923 |
2022-03-11 19:06:13 | miss-islington | set | pull_requests:
+ pull_request29922 |
2022-03-11 19:05:58 | miss-islington | set | nosy:
+ miss-islington messages:
+ msg414931
|
2022-02-22 23:03:59 | vidhya | set | nosy:
+ vidhya messages:
+ msg413754
|
2022-02-21 04:37:05 | slateny | set | keywords:
+ patch nosy:
+ slateny
pull_requests:
+ pull_request29589 stage: needs patch -> patch review |
2022-01-07 00:16:13 | iritkatriel | set | keywords:
+ easy title: bug in dateutil\tz\tz.py -> [doc] Add example of platform-specific support for negative timestamps to the time doc versions:
+ Python 3.9, Python 3.10, Python 3.11, - Python 3.7, Python 3.8 |
2019-03-28 13:52:04 | p-ganssle | set | messages:
+ msg339042 |
2019-03-28 08:29:22 | matrixise | set | messages:
+ msg339020 |
2019-03-28 08:28:43 | matrixise | set | messages:
+ msg339019 |
2019-03-28 08:27:52 | matrixise | set | messages:
+ msg339018 |
2019-03-27 23:00:50 | xtreak | set | nosy:
+ p-ganssle
|
2019-03-27 22:49:07 | cheryl.sabella | set | stage: needs patch versions:
+ Python 3.7, Python 3.8, - Python 3.6 |
2017-10-11 16:52:47 | belopolsky | set | messages:
+ msg304162 |
2017-10-11 16:33:41 | tim.peters | set | nosy:
+ belopolsky messages:
+ msg304161
|
2017-10-11 16:24:17 | matrixise | set | messages:
+ msg304160 |
2017-10-11 16:22:20 | tim.peters | set | nosy:
+ docs@python messages:
+ msg304159
assignee: docs@python components:
+ Documentation, - Library (Lib) type: crash -> enhancement |
2017-10-11 16:00:50 | matrixise | set | messages:
+ msg304155 |
2017-10-11 15:48:49 | tim.peters | set | nosy:
+ tim.peters messages:
+ msg304154
|
2017-10-11 15:39:49 | matrixise | set | nosy:
+ matrixise, steve.dower messages:
+ msg304152
|
2017-09-04 12:46:51 | louielu | set | nosy:
+ louielu messages:
+ msg301219
|
2017-09-01 17:24:09 | jerrykramskoy | create | |