Skip to content

Commit

Permalink
ERR: fix exception propogation for datetime parsing functions, noted …
Browse files Browse the repository at this point in the history
…in python 3.6

closes #14561

Author: Jeff Reback <jeff@reback.net>

Closes #14678 from jreback/py3.6_fix and squashes the following commits:

c8eed83 [Jeff Reback] ERR: fix exception propogation for datetime parsing functions, noted in python 3.6
  • Loading branch information
jreback committed Nov 17, 2016
1 parent b23a329 commit b52dda8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.19.2.txt
Expand Up @@ -38,7 +38,7 @@ Bug Fixes




- Bug in not propogating exceptions in parsing invalid datetimes, noted in python 3.6 (:issue:`14561`)



Expand Down
8 changes: 4 additions & 4 deletions pandas/src/datetime.pxd
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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)

3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -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
Expand Down

0 comments on commit b52dda8

Please sign in to comment.