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