-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Adding big offset to timedelta generates a python crash #14080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
thought we had an issue for this.... its an wraparound thing I think. PR's are welcome. |
Any pointers on how to fix this? |
step thru the code - this hits cython at some point (for the add) then again for the construction of a new Timestamp - think it's crashing there |
I generated the stack trace, and stepped through the code. I've isolated the problem to the subset of the trace I've attached. `> /home/bhaprayan/Workspace/pandas/pandas/tseries/offsets.py(393)radd()
|
so I think that multiplcation needs a guard on overflow
|
First, I set a guard on the multiplication overflow. However it's still stuck in a recursive loop, where after catching the OverflowError, it still calls radd. `ipdb> s
ipdb> s
ipdb> s
ipdb> s
ipdb> s
ipdb> s
ipdb> s
|
Looks like this issue was already solved, by running the reproduction scenario now I get a clear exception: |
great do u want to do a PR with some tests ? |
I put together a quick smoke test, and indeed it looks like things are generating exceptions like they should. But two offsets, the FY5253Quarter and DateOffset cases, both take forever to fail, ~20s in one case, ~10s in the other, so something's different about them (I haven't given even a cursory glance). |
this is already fixed in master if someone would like to add tests in a PR |
Code Sample, a copy-pastable example if possible
In:
Out:
=> python crash
Fatal Python error: Cannot recover from stack overflow.
Current thread 0x00002b00 (most recent call first):
File "C:\Users\geoffroy.destaintot\Miniconda3\envs\pd-0.18\lib\site-packages\pandas\tseries\offsets.py", line 2526 in delta
File "C:\Users\geoffroy.destaintot\Miniconda3\envs\pd-0.18\lib\site-packages\pandas\tseries\offsets.py", line 2535 in apply
File "C:\Users\geoffroy.destaintot\Miniconda3\envs\pd-0.18\lib\site-packages\pandas\tseries\offsets.py", line 2493 in add
File "C:\Users\geoffroy.destaintot\Miniconda3\envs\pd-0.18\lib\site-packages\pandas\tseries\offsets.py", line 390 in radd
File "C:\Users\geoffroy.destaintot\Miniconda3\envs\pd-0.18\lib\site-packages\pandas\tseries\offsets.py", line 2535 in apply
File "C:\Users\geoffroy.destaintot\Miniconda3\envs\pd-0.18\lib\site-packages\pandas\tseries\offsets.py", line 2493 in add
File "C:\Users\geoffroy.destaintot\Miniconda3\envs\pd-0.18\lib\site-packages\pandas\tseries\offsets.py", line 390 in radd
...
Expected Output
Satisfactory behaviour when using python timedeltas:
In:
Out:
=> python error
Traceback (most recent call last):
File "C:/Users/geoffroy.destaintot/Documents/Local/Informatique/Projets/2016-08-django-debug/to_offset_bug.py", line 11, in
d + dt.timedelta(days=1)100*25
OverflowError: Python int too large to convert to C long
output of
pd.show_versions()
(same behaviour with pandas 0.17.1, 0.16.2, 0.15.2)
INSTALLED VERSIONS
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 69 Stepping 1, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 25.1.6
Cython: None
numpy: 1.11.1
scipy: None
statsmodels: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: