Stefan Behnel, 09.11.2013 08:20: > Stefan Behnel, 09.11.2013 07:17: >> Putting it all together, we can use the fast path in these cases: >> >> (sizeof(type_of_i) < sizeof(Py_ssize_t)) || >> >> (sizeof(type_of_i) > sizeof(Py_ssize_t) && >> (i <= (type_of_i)PY_SSIZE_T_MAX) && >> (!signed || i >= (type_of_i)PY_SSIZE_T_MIN)) || >> >> (sizeof(type_of_i) == sizeof(Py_ssize_t) && >> (signed || (i <= (type_of_i)PY_SSIZE_T_MAX))) >> >> >> The casts I added should keep the C compiler from complaining about unsafe >> comparisons. >> >> Then, for builtin container types, the fallback path already knows that the >> index is out of bounds and can always raise an IndexError. For unknown >> types, the existing "Generic" fallback function can be used. > > https://github.com/cython/cython/commit/b66981604baf59ea465027cc10baa42af7c76571 > > https://github.com/cython/cython/commit/0cae66191bfe42657ff0010e4ca13d032cb523b8
And if anyone has a way to make this less ugly, I'd be happy to hear about it: https://github.com/cython/cython/commit/de12778fe0995660e8f1c726194cef40885d7a15 Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel