File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
graalpython/com.oracle.graal.python.test/src/tests Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -828,3 +828,29 @@ def __hash__(self):
828
828
assert d2 [MyObject ("1" )] == 112
829
829
del d2 [MyObject ("1" )]
830
830
assert "1" not in d2
831
+
832
+ def test_update_side_effect_on_other ():
833
+ class X :
834
+ def __hash__ (self ):
835
+ return 0
836
+ def __eq__ (self , o ):
837
+ other .clear ()
838
+ return False
839
+
840
+ other = {'a' :1 , 'b' : 2 , X (): 3 , 'c' :4 }
841
+ d = {X (): 0 , 1 : 1 }
842
+ assert_raises (RuntimeError , d .update , other )
843
+ assert 'c' not in d
844
+
845
+ other = {'a' :1 , 'b' : 2 , X (): 3 , 'c' :4 }
846
+ d = {X (): 0 , 1 : 0 }
847
+ kw = {'kw' : 1 }
848
+
849
+ raised = False
850
+ try :
851
+ d .update (other , ** kw )
852
+ except RuntimeError :
853
+ raised = True
854
+ assert raised
855
+
856
+ assert 'kw' not in d
You can’t perform that action at this time.
0 commit comments