Commits

David Schneider committed 25ee4f1

catch exception raised when item is not in the list

Comments (0)

Files changed (1)

 
 @register_method('List', 'remove')
 def list_remove_all(space, w_target, w_message, w_context):
-    w_item = w_message.arguments[0].eval(space, w_target, w_context)
-    w_target.list_items.remove(w_item)
-    return w_target
-    
+    w_item = w_message.arguments[0].eval(space, w_context, w_context)
+    try:
+        w_target.list_items.remove(w_item)
+    finally:
+        return w_target
+
 @register_method('List', 'atPut')
 def list_reverse_in_place(space, w_target, w_message, w_context):
     # Help annotator