68
68
import com .oracle .graal .python .nodes .attributes .LookupCallableSlotInMRONode ;
69
69
import com .oracle .graal .python .nodes .builtins .ListNodes .FastConstructListNode ;
70
70
import com .oracle .graal .python .nodes .call .special .CallVarargsMethodNode ;
71
+ import com .oracle .graal .python .nodes .object .BuiltinClassProfiles .IsBuiltinObjectProfile ;
71
72
import com .oracle .graal .python .nodes .object .GetClassNode ;
72
73
import com .oracle .graal .python .runtime .ExecutionContext .IndirectCallContext ;
73
74
import com .oracle .graal .python .runtime .PythonContext ;
@@ -270,7 +271,8 @@ static ArrayBuilder<KeyValue> partialMergeFromSeq2(VirtualFrame frame, Object it
270
271
@ Cached FastConstructListNode createListNode ,
271
272
@ Cached LenNode seqLenNode ,
272
273
@ Cached PRaiseNode .Lazy raise ,
273
- @ Cached InlinedConditionProfile lengthTwoProfile ) throws PException {
274
+ @ Cached InlinedConditionProfile lengthTwoProfile ,
275
+ @ Cached IsBuiltinObjectProfile isTypeErrorProfile ) throws PException {
274
276
Object it = getIter .execute (frame , inliningTarget , iterable );
275
277
ArrayBuilder <KeyValue > elements = new ArrayBuilder <>();
276
278
Object next ;
@@ -291,10 +293,11 @@ static ArrayBuilder<KeyValue> partialMergeFromSeq2(VirtualFrame frame, Object it
291
293
elements .add (new KeyValue (key , value ));
292
294
}
293
295
} 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 ());
296
299
}
297
- throw raise . get ( inliningTarget ). raise ( TypeError , ErrorMessages . CANNOT_CONVERT_DICT_UPDATE_SEQ , elements . size ()) ;
300
+ throw e ;
298
301
}
299
302
return elements ;
300
303
}
0 commit comments