[New-bugs-announce] [issue31327] bug in dateutil\tz\tz.py

Jerry Kramskoy report at bugs.python.org
Fri Sep 1 13:24:09 EDT 2017

New submission from Jerry Kramskoy:

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
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

components: Library (Lib)
messages: 301143
nosy: jerrykramskoy
priority: normal
severity: normal
status: open
title: bug in dateutil\tz\tz.py
type: crash
versions: Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list