Commit 6174a694 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #72 from kkszysiu/list_iter_fix

Removed assert from str to make __iter__ work again
parents 0b282960 93c84769
...@@ -1015,8 +1015,6 @@ extern "C" BoxedString* str(Box* obj) { ...@@ -1015,8 +1015,6 @@ extern "C" BoxedString* str(Box* obj) {
str = getclsattr_internal(obj, "__repr__", NULL, NULL); str = getclsattr_internal(obj, "__repr__", NULL, NULL);
if (str == NULL) { if (str == NULL) {
ASSERT(isUserDefined(obj->cls), "%s.__str__", getTypeName(obj)->c_str());
char buf[80]; char buf[80];
snprintf(buf, 80, "<%s object at %p>", getTypeName(obj)->c_str(), obj); snprintf(buf, 80, "<%s object at %p>", getTypeName(obj)->c_str(), obj);
return boxStrConstant(buf); return boxStrConstant(buf);
......
a = [3, 2, 1]
b = [2, 'a', (3, 2)]
# TODO: uncomment when hassattr will be implemented
#assert hasattr(a, '__iter__')
iter_a = a.__iter__()
assert iter_a.next() == 3
assert iter_a.next() == 2
assert iter_a.next() == 1
iter_b = b.__iter__()
assert iter_b.next() == 2
assert iter_b.next() == 'a'
assert iter_b.next() == (3, 2)
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