dateutil/dateutil
Auf GitHub ansehenutcoffset crash on Windows with EPOCH and tzlocal for timezone GMT+x
Open
#197 geöffnet am 1. März 2016
bughelp wantedmedium-difficultytime zones
Repository-Metriken
- Stars
- (2.189 Stars)
- PR-Merge-Metriken
- (Keine gemergten PRs in 30 T)
Beschreibung
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.