parser breaks with bad input
Bug #1071212 reported by
Tomi Hukkalainen
This bug affects 4 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dateutil |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Reported at http://
>>> dparser.parse("P 16:08 May 14, 2003 UTC", fuzzy=True)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/
return DEFAULTPARSER.
File "/usr/lib/
res = self._parse(
File "/usr/lib/
res.hour += 12
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'int'
To post a comment you must log in.
Confirmed.
My problematic strings all start with "PM" - they're not dates, but it doesn't raise an exception for other non-date strings.
My understanding is that the "PM" string is being interpreted as "a time in the afternoon", and thus the number before it is having 12 added to it. This isn't valid if the value before it is None.
I can probably patch this, but will do so only if there is an indication that it'll be acted on.