10000 utcoffset crash on Windows with EPOCH and tzlocal for timezone GMT+x · Issue #197 · dateutil/dateutil · GitHub
[go: up one dir, main page]

Skip to content
utcoffset crash on Windows with EPOCH and tzlocal for timezone GMT+x #197
@ggtools

Description

@ggtools

My local time zone is Europe/Paris and I noticed that on Windows the following operation crashed:

>>> datetime.fromtimestamp(0,tz.tzlocal())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda3\lib\site-packages\dateutil\tz.py", line 99, in utcoffset
    if self._isdst(dt):
  File "C:\Anaconda3\lib\site-packages\dateutil\tz.py", line 143, in _isdst
    return time.localtime(timestamp+time.timezone).tm_isdst
OSError: [Errno 22] Invalid argument

The same on Linux is working fine.

Looking at the code I discovered that the issue is caused by the call to time.localtime() with -3600 as argument. This is working fine on Linux but not on Windows.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0