Skip to content

Commit c770661

Browse files
committed
Rename parse_slashed_date to parse_delimited_date
1 parent 21cf1ac commit c770661

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pandas/_libs/tslibs/parsing.pyx

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,14 @@ cdef inline int _parse_4digit(const char* s):
7979
result += getdigit_ascii(s[3], -10000) * 1
8080
return result
8181

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):
8484
cdef:
8585
const char* buf
8686
Py_ssize_t length
87-
int day, month, year
87+
int day = 1, month = 1, year
8888

89+
assert isinstance(date_string, (str, unicode))
8990
buf = get_c_string_buf_and_size(date_string, &length)
9091
if length == 10:
9192
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,
9798
if _is_not_delimiter(buf[2]):
9899
return None
99100
month = _parse_2digit(buf)
100-
day = 1
101101
year = _parse_4digit(buf + 3)
102102
else:
103103
return None
@@ -140,7 +140,7 @@ def parse_datetime_string(date_string, freq=None, dayfirst=False,
140140
yearfirst=yearfirst, **kwargs)
141141
return dt
142142

143-
dt = parse_slashed_date(date_string, dayfirst, _DEFAULT_TZINFO)
143+
dt = parse_delimited_date(date_string, dayfirst, _DEFAULT_TZINFO)
144144
if dt is not None:
145145
return dt
146146

0 commit comments

Comments
 (0)