Commit 2b225234 authored by Tom Niget's avatar Tom Niget

Fix slice computation

parent 7f288103
...@@ -42,10 +42,14 @@ struct PySlice { ...@@ -42,10 +42,14 @@ struct PySlice {
if (this->start == std::nullopt) { if (this->start == std::nullopt) {
res.start = res.step < 0 ? PY_SSIZE_T_MAX : 0; res.start = res.step < 0 ? PY_SSIZE_T_MAX : 0;
} else {
res.start = this->start.value();
} }
if (this->stop == std::nullopt) { if (this->stop == std::nullopt) {
res.stop = res.step < 0 ? PY_SSIZE_T_MIN : PY_SSIZE_T_MAX; res.stop = res.step < 0 ? PY_SSIZE_T_MIN : PY_SSIZE_T_MAX;
} else {
res.stop = this->stop.value();
} }
auto len = PySlice_AdjustIndices(seq_length, &res.start, &res.stop, res.step); auto len = PySlice_AdjustIndices(seq_length, &res.start, &res.stop, res.step);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment