Skip to content

Commit eb946df

Browse files
committed
CLN: remove except clause from string_to_dts, xref GH#50515
1 parent 4088ec2 commit eb946df

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

pandas/_libs/tslib.pyx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,15 @@ def _test_parse_iso8601(ts: str):
9494
_TSObject obj
9595
int out_local = 0, out_tzoffset = 0
9696
NPY_DATETIMEUNIT out_bestunit
97+
bint failed
9798

9899
obj = _TSObject()
99100

100-
string_to_dts(ts, &obj.dts, &out_bestunit, &out_local, &out_tzoffset, True)
101+
failed = string_to_dts(
102+
ts, &obj.dts, &out_bestunit, &out_local, &out_tzoffset, False
103+
)
104+
if failed:
105+
raise ValueError("string_to_dts failed")
101106
try:
102107
obj.value = npy_datetimestruct_to_datetime(NPY_FR_ns, &obj.dts)
103108
except OverflowError as err:

pandas/_libs/tslibs/np_datetime.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ cdef int string_to_dts(
9191
bint want_exc,
9292
str format = *,
9393
bint exact = *
94-
) except? -1
94+
)
9595

9696
cdef NPY_DATETIMEUNIT get_unit_from_dtype(cnp.dtype dtype)
9797

pandas/_libs/tslibs/np_datetime.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ cdef int string_to_dts(
346346
bint want_exc,
347347
str format=None,
348348
bint exact=True,
349-
) except? -1:
349+
):
350350
cdef:
351351
Py_ssize_t length
352352
const char* buf

0 commit comments

Comments
 (0)