error when creating datetime.time with dateutil.tz.tzlocal

Bug #1256908 reported by Jan Spurny
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
dateutil
New
Undecided
Unassigned

Bug Description

Creating datetime.time with dateutil.tz.tzlocal creates valid datetime.time object, but this object raises error when __str__, __repr__ or isoformat method is called on it.

Demonstration:

 >>> import datetime
 >>> import dateutil.tz
 >>> t1 = datetime.time(1, 2, tzinfo=dateutil.tz.tzutc())
 >>> t2 = datetime.time(1, 2, tzinfo=dateutil.tz.tzlocal())
 >>> t1
 datetime.time(1, 2, tzinfo=tzutc())
 >>> t2
 datetime.time(1, 2, tzinfo=tzlocal())
 >>> print t1
 01:02:00+00:00
 >>> print t2
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib/pymodules/python2.6/dateutil/tz.py", line 92, in utcoffset
     if self._isdst(dt):
   File "/usr/lib/pymodules/python2.6/dateutil/tz.py", line 134, in _isdst
     + dt.second)
 AttributeError: 'NoneType' object has no attribute 'toordinal'

My locale timezone is "Europe/Prague", python2.6, dateutil 1.4.1, debian linux.

Jan Spurny (jspurny)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.