[issue27333] validate_step in rangeobject.c, incorrect code logic but right result
Xiang Zhang
report at bugs.python.org
Fri Jun 17 11:17:51 EDT 2016
Xiang Zhang added the comment:
This looks fine. But maybe code like this looks more clear:
if (step && _PyLong_Sign(step) == 0) {
PyErr_SetString(PyExc_ValueError,
"range() arg 3 must not be zero");
Py_CLEAR(step);
}
I think assert(PyLong_Check(step)) can be left out since _PyLong_Sign also checks it.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27333>
_______________________________________
More information about the Python-bugs-list
mailing list