diff --git a/doc/source/whatsnew/v0.19.2.txt b/doc/source/whatsnew/v0.19.2.txt index f193de7fbdbd0..f4a45a6938a95 100644 --- a/doc/source/whatsnew/v0.19.2.txt +++ b/doc/source/whatsnew/v0.19.2.txt @@ -38,7 +38,7 @@ Bug Fixes - +- Bug in not propogating exceptions in parsing invalid datetimes, noted in python 3.6 (:issue:`14561`) diff --git a/pandas/src/datetime.pxd b/pandas/src/datetime.pxd index 5f7de8244d17e..d3d471a33715d 100644 --- a/pandas/src/datetime.pxd +++ b/pandas/src/datetime.pxd @@ -126,8 +126,8 @@ cdef extern from "datetime/np_datetime_strings.h": -cdef inline _string_to_dts(object val, pandas_datetimestruct* dts, - int* out_local, int* out_tzoffset): +cdef inline int _string_to_dts(object val, pandas_datetimestruct* dts, + int* out_local, int* out_tzoffset) except? -1: cdef int result cdef char *tmp @@ -139,10 +139,11 @@ cdef inline _string_to_dts(object val, pandas_datetimestruct* dts, if result == -1: raise ValueError('Unable to parse %s' % str(val)) + return result cdef inline int _cstring_to_dts(char *val, int length, pandas_datetimestruct* dts, - int* out_local, int* out_tzoffset): + int* out_local, int* out_tzoffset) except? -1: cdef: npy_bool special PANDAS_DATETIMEUNIT out_bestunit @@ -195,4 +196,3 @@ cdef inline int64_t _date_to_datetime64(object val, dts.hour = dts.min = dts.sec = dts.us = 0 dts.ps = dts.as = 0 return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts) - diff --git a/setup.py b/setup.py index a17dd502d7706..351d2b39ce6aa 100755 --- a/setup.py +++ b/setup.py @@ -454,7 +454,8 @@ def pxd(name): tseries_depends = ['pandas/src/datetime/np_datetime.h', 'pandas/src/datetime/np_datetime_strings.h', - 'pandas/src/period_helper.h'] + 'pandas/src/period_helper.h', + 'pandas/src/datetime.pxd'] # some linux distros require it