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