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