@@ -1021,14 +1021,19 @@ abstract static class GetArgNode extends Node {
1021
1021
static Object doNoKeywords (ParserState state , Object kwds , Object kwdnames , boolean keywordsOnly ,
1022
1022
@ Shared ("lenNode" ) @ Cached SequenceNodes .LenNode lenNode ,
1023
1023
@ Shared ("getSequenceStorageNode" ) @ Cached GetSequenceStorageNode getSequenceStorageNode ,
1024
- @ Shared ("getItemNode" ) @ Cached SequenceStorageNodes .GetItemDynamicNode getItemNode ) {
1024
+ @ Shared ("getItemNode" ) @ Cached SequenceStorageNodes .GetItemDynamicNode getItemNode ,
1025
+ @ Shared ("raiseNode" ) @ Cached PRaiseNativeNode raiseNode ) {
1025
1026
1026
1027
Object out = null ;
1027
1028
assert !keywordsOnly ;
1028
1029
int l = lenNode .execute (state .v .argv );
1029
1030
if (state .v .argnum < l ) {
1030
1031
out = getItemNode .execute (getSequenceStorageNode .execute (state .v .argv ), state .v .argnum );
1031
1032
}
1033
+ if (out == null && !state .restOptional ) {
1034
+ raiseNode .raiseIntWithoutFrame (0 , TypeError , "%s missing required argument (pos %d)" , state .funName , state .v .argnum );
1035
+ throw ParseArgumentsException .raise ();
1036
+ }
1032
1037
state .v .argnum ++;
1033
1038
return out ;
1034
1039
}
@@ -1041,7 +1046,8 @@ static Object doGeneric(ParserState state, Object kwds, Object kwdnames, boolean
1041
1046
@ Cached HashingCollectionNodes .GetDictStorageNode getDictStorageNode ,
1042
1047
@ CachedLibrary (limit = "1" ) InteropLibrary kwdnamesLib ,
1043
1048
@ CachedLibrary (limit = "1" ) HashingStorageLibrary lib ,
1044
- @ Cached PCallCExtFunction callCStringToString ) throws InteropException {
1049
+ @ Cached PCallCExtFunction callCStringToString ,
1050
+ @ Shared ("raiseNode" ) @ Cached PRaiseNativeNode raiseNode ) throws InteropException {
1045
1051
1046
1052
Object out = null ;
1047
1053
if (!keywordsOnly ) {
@@ -1062,6 +1068,10 @@ static Object doGeneric(ParserState state, Object kwds, Object kwdnames, boolean
1062
1068
out = lib .getItem (getDictStorageNode .execute ((PDict ) kwds ), kwdname );
1063
1069
}
1064
1070
}
1071
+ if (out == null && !state .restOptional ) {
1072
+ raiseNode .raiseIntWithoutFrame (0 , TypeError , "%s missing required argument (pos %d)" , state .funName , state .v .argnum );
1073
+ throw ParseArgumentsException .raise ();
1074
+ }
1065
1075
state .v .argnum ++;
1066
1076
return out ;
1067
1077
}
0 commit comments