Commit 0e111b5f authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #371 from corona10/master

parents 8d4601e2 c0de9f66
......@@ -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();
......
......@@ -100,3 +100,5 @@ print repr(b'1234')
print callable(1)
print callable(int)
print callable(lambda: 1)
print range(5L, 7L)
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