[pypy-commit] lang-io default: catch exception raised when item is not in the list

bivab noreply at buildbot.pypy.org
Thu Sep 22 18:01:20 CEST 2011


Author: David Schneider <david.schneider at picle.org>
Branch: 
Changeset: r42:25ee4f13a748
Date: 2011-09-22 13:18 +0200
http://bitbucket.org/pypy/lang-io/changeset/25ee4f13a748/

Log:	catch exception raised when item is not in the list

diff --git a/io/list.py b/io/list.py
--- a/io/list.py
+++ b/io/list.py
@@ -131,10 +131,12 @@
 
 @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


More information about the pypy-commit mailing list