Commit e228e38b authored by Dong-hee,Na's avatar Dong-hee,Na Committed by Kevin Modzelewski

quick fix for support long type in range() function

parent 8d4601e2
......@@ -410,27 +410,23 @@ extern "C" Box* ord(Box* obj) {
Box* range(Box* start, Box* stop, Box* step) {
i64 istart, istop, istep;
if (stop == NULL) {
RELEASE_ASSERT(isSubclass(start->cls, int_cls), "%s", getTypeName(start));
istart = 0;
istop = static_cast<BoxedInt*>(start)->n;
istop = PyLong_AsLong(start);
checkAndThrowCAPIException();
istep = 1;
} else if (step == NULL) {
RELEASE_ASSERT(isSubclass(start->cls, int_cls), "%s", getTypeName(start));
RELEASE_ASSERT(isSubclass(stop->cls, int_cls), "%s", getTypeName(stop));
istart = static_cast<BoxedInt*>(start)->n;
istop = static_cast<BoxedInt*>(stop)->n;
istart = PyLong_AsLong(start);
checkAndThrowCAPIException();
istop = PyLong_AsLong(stop);
checkAndThrowCAPIException();
istep = 1;
} else {
RELEASE_ASSERT(isSubclass(start->cls, int_cls), "%s", getTypeName(start));
RELEASE_ASSERT(isSubclass(stop->cls, int_cls), "%s", getTypeName(stop));
RELEASE_ASSERT(isSubclass(step->cls, int_cls), "%s", getTypeName(step));
istart = static_cast<BoxedInt*>(start)->n;
istop = static_cast<BoxedInt*>(stop)->n;
istep = static_cast<BoxedInt*>(step)->n;
RELEASE_ASSERT(istep != 0, "step can't be 0");
istart = PyLong_AsLong(start);
checkAndThrowCAPIException();
istop = PyLong_AsLong(stop);
checkAndThrowCAPIException();
istep = PyLong_AsLong(step);
checkAndThrowCAPIException();
}
BoxedList* rtn = new BoxedList();
......
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