You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
static INLINE size_t __pyx_PyInt_AsSize_t(PyObject* b) {
unsigned PY_LONG_LONG val =
__pyx_PyInt_AsUnsignedLongLong(b);
if (unlikely(val == (unsigned PY_LONG_LONG)-1 &&
PyErr_Occurred())) {
return (size_t)-1;
The (size_t)-1 definitely looks funny. I noticed that (unsigned PY_LONG_LONG)-1 is also used in __pyx_PyInt_AsUnsignedLongLong(), so I just hope it does the right thing.
} else if (unlikely((unsigned PY_LONG_LONG)(size_t)val
!= val)) {
PyErr_SetString(PyExc_OverflowError, "value too
large to convert to size_t");
This should return an error value, so it lacks a return (size_t)-1.
}
return val;
}
It would be great if we had tests for the error cases. It's not obvious
that they work as expected. The same applies to the "unsigned long long"
conversion, IMHO.
http://codespeak.net/pipermail/cython-dev/2009-February/003670.html
At 2009-02-06T21:54:11Z @dalcinl added attachment SIZE_T.diff
Migrated from http://trac.cython.org/ticket/207
The text was updated successfully, but these errors were encountered: