6868import com .oracle .graal .python .nodes .attributes .LookupCallableSlotInMRONode ;
6969import com .oracle .graal .python .nodes .builtins .ListNodes .FastConstructListNode ;
7070import com .oracle .graal .python .nodes .call .special .CallVarargsMethodNode ;
71+ import com .oracle .graal .python .nodes .object .BuiltinClassProfiles .IsBuiltinObjectProfile ;
7172import com .oracle .graal .python .nodes .object .GetClassNode ;
7273import com .oracle .graal .python .runtime .ExecutionContext .IndirectCallContext ;
7374import com .oracle .graal .python .runtime .PythonContext ;
@@ -270,7 +271,8 @@ static ArrayBuilder<KeyValue> partialMergeFromSeq2(VirtualFrame frame, Object it
270271 @ Cached FastConstructListNode createListNode ,
271272 @ Cached LenNode seqLenNode ,
272273 @ Cached PRaiseNode .Lazy raise ,
273- @ Cached InlinedConditionProfile lengthTwoProfile ) throws PException {
274+ @ Cached InlinedConditionProfile lengthTwoProfile ,
275+ @ Cached IsBuiltinObjectProfile isTypeErrorProfile ) throws PException {
274276 Object it = getIter .execute (frame , inliningTarget , iterable );
275277 ArrayBuilder <KeyValue > elements = new ArrayBuilder <>();
276278 Object next ;
@@ -291,10 +293,11 @@ static ArrayBuilder<KeyValue> partialMergeFromSeq2(VirtualFrame frame, Object it
291293 elements .add (new KeyValue (key , value ));
292294 }
293295 } catch (PException e ) {
294- if (lengthTwoProfile .profile (inliningTarget , len != 2 )) {
295- throw e ;
296+ if (!lengthTwoProfile .profile (inliningTarget , len != 2 ) &&
297+ isTypeErrorProfile .profileException (inliningTarget , e , TypeError )) {
298+ throw raise .get (inliningTarget ).raise (TypeError , ErrorMessages .CANNOT_CONVERT_DICT_UPDATE_SEQ , elements .size ());
296299 }
297- throw raise . get ( inliningTarget ). raise ( TypeError , ErrorMessages . CANNOT_CONVERT_DICT_UPDATE_SEQ , elements . size ()) ;
300+ throw e ;
298301 }
299302 return elements ;
300303 }
0 commit comments