-
Notifications
You must be signed in to change notification settings - Fork 110
int64 overflow/wrap around with nansum() #163
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
That's odd. On linux with py2.7:
Python, not bottleneck, raises on the second example. |
Using
Would be nice to have this issue fixed in the 1.2.1 release #168. |
I was using this: diff --git a/bottleneck/src/reduce_template.c b/bottleneck/src/reduce_template.c
index d9fa955..031e1eb 100644
--- a/bottleneck/src/reduce_template.c
+++ b/bottleneck/src/reduce_template.c
@@ -129,7 +129,7 @@ REDUCE_ALL(nansum, DTYPE0)
NEXT
}
BN_END_ALLOW_THREADS
- return PyInt_FromLong(asum);
+ return PyLong_FromLongLong(asum);
}
REDUCE_ONE(nansum, DTYPE0)
@@ -506,7 +506,7 @@ REDUCE_ALL(NAME, DTYPE0)
NEXT
}
BN_END_ALLOW_THREADS
- return PyInt_FromLong(extreme);
+ return PyLong_FromLongLong(extreme);
}
REDUCE_ONE(NAME, DTYPE0)
@@ -571,7 +571,7 @@ REDUCE_ALL(NAME, DTYPE0)
VALUE_ERR("All-NaN slice encountered");
return NULL;
} else {
- return PyInt_FromLong(idx);
+ return PyLong_FromLongLong(idx);
}
}
@@ -636,7 +636,7 @@ REDUCE_ALL(NAME, DTYPE0)
}
BN_END_ALLOW_THREADS
DECREF_INIT_ALL_RAVEL
- return PyInt_FromLong(idx);
+ return PyLong_FromLongLong(idx);
}
REDUCE_ONE(NAME, DTYPE0)
@@ -728,7 +728,7 @@ REDUCE_ALL(ss, DTYPE0)
NEXT
}
BN_END_ALLOW_THREADS
- return PyInt_FromLong(asum);
+ return PyLong_FromLongLong(asum);
}
REDUCE_ONE(ss, DTYPE0)
|
@cgohlke Your bug fix is a huge help. Thank you! |
See pandas-dev/pandas#15453
The text was updated successfully, but these errors were encountered: