@@ -79,13 +79,14 @@ cdef inline int _parse_4digit(const char* s):
79
79
result += getdigit_ascii(s[3 ], - 10000 ) * 1
80
80
return result
81
81
82
- cdef object parse_slashed_date (object date_string, bint dayfirst,
83
- object tzinfo):
82
+ cdef inline object parse_delimited_date (object date_string, bint dayfirst,
83
+ object tzinfo):
84
84
cdef:
85
85
const char * buf
86
86
Py_ssize_t length
87
- int day, month, year
87
+ int day = 1 , month = 1 , year
88
88
89
+ assert isinstance (date_string, (str , unicode ))
89
90
buf = get_c_string_buf_and_size(date_string, & length)
90
91
if length == 10 :
91
92
if _is_not_delimiter(buf[2 ]) or _is_not_delimiter(buf[5 ]):
@@ -97,7 +98,6 @@ cdef object parse_slashed_date(object date_string, bint dayfirst,
97
98
if _is_not_delimiter(buf[2 ]):
98
99
return None
99
100
month = _parse_2digit(buf)
100
- day = 1
101
101
year = _parse_4digit(buf + 3 )
102
102
else :
103
103
return None
@@ -140,7 +140,7 @@ def parse_datetime_string(date_string, freq=None, dayfirst=False,
140
140
yearfirst = yearfirst, ** kwargs)
141
141
return dt
142
142
143
- dt = parse_slashed_date (date_string, dayfirst, _DEFAULT_TZINFO)
143
+ dt = parse_delimited_date (date_string, dayfirst, _DEFAULT_TZINFO)
144
144
if dt is not None :
145
145
return dt
146
146
0 commit comments