Invalid datetime string conversion giving SystemError with Python 3.6.0b3 · Issue #14561 · pandas-dev/pandas (original) (raw)

From #14552, using Python 3.6.0b3 and pandas 0.19.0:

In [12]: pd.Timestamp('invalid')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
ValueError: Error parsing datetime string "invalid" at position 0 

The above exception was the direct cause of the following exception:

SystemError                               Traceback (most recent call last)
<ipython-input-12-91abde127db1> in <module>()
----> 1 pd.Timestamp('invalid')
pandas/tslib.pyx in pandas.tslib.Timestamp.__new__ (pandas/tslib.c:9932)()
pandas/tslib.pyx in pandas.tslib.convert_to_tsobject (pandas/tslib.c:25231)()
pandas/tslib.pyx in pandas.tslib.convert_str_to_tsobject (pandas/tslib.c:26851)()
pandas/src/datetime.pxd in datetime._string_to_dts (pandas/tslib.c:87106)()
SystemError: <class 'str'> returned a result with an error set

gives a SystemError (which gives problems in the indexing code etc), while with python < 3.6, you get a ValueError:

In [56]: pd.Timestamp('next')
...
series of "During handling of the above exception, another exception occurred:"
...

/home/joris/scipy/pandas/pandas/tslib.pyx in pandas.tslib.convert_str_to_tsobject (pandas/tslib.c:27281)()
   1537                     ts, dayfirst=dayfirst, yearfirst=yearfirst)
   1538             except Exception:
-> 1539                 raise ValueError("could not convert string to Timestamp")
   1540 
   1541     return convert_to_tsobject(ts, tz, unit, dayfirst, yearfirst)

ValueError: could not convert string to Timestamp