[issue14781] strptime fails for year 0

Matthias Meyer report at bugs.python.org
Fri May 11 12:54:35 CEST 2012


New submission from Matthias Meyer <meyer.matze at googlemail.com>:

Hi folks,

What I did:
import time
time.strptime('0000-10-03T15:35:05Z','%Y-%m-%dT%H:%M:%SZ')

What I expected:
time.struct_time(tm_year=0, tm_mon=10, tm_mday=3, tm_hour=15, tm_min=35, tm_sec=5, tm_wday=2, tm_yday=276, tm_isdst=-1)

What I got:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/_strptime.py", line 454, in _strptime_time
    return _strptime(data_string, format)[0]
  File "/usr/lib/python2.7/_strptime.py", line 440, in _strptime
    datetime_date(year, 1, 1).toordinal() + 1
ValueError: year is out of range


Environment:
Ubuntu 12.04 x64
python --version: 2.7.3


If you need more information, please let me know...

----------
components: Library (Lib)
messages: 160404
nosy: Matthias.Meyer
priority: normal
severity: normal
status: open
title: strptime fails for year 0
type: crash
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14781>
_______________________________________


More information about the Python-bugs-list mailing list