@@ -380,15 +380,15 @@ public enum PExternalFunctionWrapper implements NativeCExtSymbol {
380
380
GE (26 , PyObjectTransfer , PyObject , PyObject , Int ),
381
381
ITERNEXT (27 , IterResult , PyObject ),
382
382
INQUIRY (28 , InquiryResult , PyObject ),
383
- DELITEM (29 , Int , PyObject , Py_ssize_t , PyObject ),
383
+ DELITEM (29 , defaults ( 1 ), Int , PyObject , Py_ssize_t , PyObject ),
384
384
GETITEM (30 , PyObjectTransfer , PyObject , Py_ssize_t ),
385
385
GETTER (31 , PyObjectTransfer , PyObject , Pointer ),
386
386
SETTER (32 , Int , PyObject , PyObject , Pointer ),
387
387
INITPROC (33 , InitResult , PyObject , PyObject , PyObject ),
388
388
HASHFUNC (34 , PrimitiveResult64 , PyObject ),
389
389
CALL (35 , PyObjectTransfer , PyObject , PyObject , PyObject ),
390
390
SETATTRO (36 , InitResult , PyObject , PyObject , PyObject ),
391
- DESCR_GET (37 , PyObjectTransfer , PyObject , PyObject , PyObject ),
391
+ DESCR_GET (37 , defaults ( 1 ), PyObjectTransfer , PyObject , PyObject , PyObject ),
392
392
DESCR_SET (38 , InitResult , PyObject , PyObject , PyObject ),
393
393
LENFUNC (39 , PrimitiveResult64 , PyObject ),
394
394
OBJOBJPROC (40 , InquiryResult , PyObject , PyObject ),
@@ -400,14 +400,19 @@ public enum PExternalFunctionWrapper implements NativeCExtSymbol {
400
400
DESCR_DELETE (46 , InitResult , PyObject , PyObject , PyObject ), // the last one is always NULL
401
401
DELATTRO (47 , InitResult , PyObject , PyObject , PyObject ); // the last one is always NULL
402
402
403
+ private static int defaults (int x ) {
404
+ return x ;
405
+ }
406
+
403
407
@ CompilationFinal (dimensions = 1 ) private static final PExternalFunctionWrapper [] VALUES = values ();
404
408
@ CompilationFinal (dimensions = 1 ) private static final PExternalFunctionWrapper [] BY_ID = new PExternalFunctionWrapper [50 ];
405
409
406
410
public final String signature ;
407
411
public final ArgDescriptor returnValue ;
408
412
public final ArgDescriptor [] arguments ;
413
+ public final int numDefaults ;
409
414
410
- PExternalFunctionWrapper (int value , ArgDescriptor returnValue , ArgDescriptor ... arguments ) {
415
+ PExternalFunctionWrapper (int value , int numDefaults , ArgDescriptor returnValue , ArgDescriptor ... arguments ) {
411
416
this .value = value ;
412
417
this .returnValue = returnValue ;
413
418
this .arguments = arguments ;
@@ -419,6 +424,11 @@ public enum PExternalFunctionWrapper implements NativeCExtSymbol {
419
424
}
420
425
s .append ("):" ).append (returnValue .getNFISignature ());
421
426
this .signature = s .toString ();
427
+ this .numDefaults = numDefaults ;
428
+ }
429
+
430
+ PExternalFunctionWrapper (int value , ArgDescriptor returnValue , ArgDescriptor ... arguments ) {
431
+ this (value , 0 , returnValue , arguments );
422
432
}
423
433
424
434
private final int value ;
@@ -693,7 +703,7 @@ public static PBuiltinFunction createWrapperFunction(TruffleString name, Object
693
703
694
704
// generate default values for positional args (if necessary)
695
705
if (numDefaults == -1 ) {
696
- numDefaults = sig == DELITEM ? 1 : 0 ;
706
+ numDefaults = sig . numDefaults ;
697
707
}
698
708
Object [] defaults = PBuiltinFunction .generateDefaults (numDefaults );
699
709
0 commit comments