@@ -262,7 +262,6 @@ static RootCallTarget getOrCreateCallTarget(PExternalFunctionWrapper sig, Python
262
262
rootNodeFunction = doArgAndResultConversion ? l -> new AllocFuncRootNode (l , name , sig ) : l -> new AllocFuncRootNode (l , name );
263
263
break ;
264
264
case DIRECT :
265
- case DESCR_GET :
266
265
case DESCR_SET :
267
266
case LENFUNC :
268
267
case HASHFUNC :
@@ -318,6 +317,10 @@ static RootCallTarget getOrCreateCallTarget(PExternalFunctionWrapper sig, Python
318
317
nodeKlass = SetAttrFuncRootNode .class ;
319
318
rootNodeFunction = doArgAndResultConversion ? l -> new SetAttrFuncRootNode (l , name , sig ) : l -> new SetAttrFuncRootNode (l , name );
320
319
break ;
320
+ case DESCR_GET :
321
+ nodeKlass = DescrGetRootNode .class ;
322
+ rootNodeFunction = doArgAndResultConversion ? l -> new DescrGetRootNode (l , name , sig ) : l -> new DescrGetRootNode (l , name );
323
+ break ;
321
324
case RICHCMP :
322
325
nodeKlass = RichCmpFuncRootNode .class ;
323
326
rootNodeFunction = doArgAndResultConversion ? l -> new RichCmpFuncRootNode (l , name , sig ) : l -> new RichCmpFuncRootNode (l , name );
@@ -1357,6 +1360,46 @@ public Signature getSignature() {
1357
1360
}
1358
1361
}
1359
1362
1363
+ /**
1364
+ * Implements semantics of {@code typeobject.c:wrap_descr_get}
1365
+ */
1366
+ public static final class DescrGetRootNode extends MethodDescriptorRoot {
1367
+ private static final Signature SIGNATURE = new Signature (-1 , false , -1 , false , new String []{"self" , "obj" , "type" }, KEYWORDS_HIDDEN_CALLABLE , true );
1368
+ @ Child private ReadIndexedArgumentNode readObj ;
1369
+ @ Child private ReadIndexedArgumentNode readType ;
1370
+
1371
+ public DescrGetRootNode (PythonLanguage language , String name ) {
1372
+ super (language , name , false );
1373
+ }
1374
+
1375
+ public DescrGetRootNode (PythonLanguage language , String name , PExternalFunctionWrapper provider ) {
1376
+ super (language , name , false , provider );
1377
+ this .readObj = ReadIndexedArgumentNode .create (1 );
1378
+ this .readType = ReadIndexedArgumentNode .create (2 );
1379
+ }
1380
+
1381
+ @ Override
1382
+ protected Object [] prepareCArguments (VirtualFrame frame ) {
1383
+ Object self = readSelf (frame );
1384
+ Object obj = readObj .execute (frame );
1385
+ Object type = readType .execute (frame );
1386
+ return new Object []{self , obj == PNone .NONE ? PNone .NO_VALUE : obj , type == PNone .NONE ? PNone .NO_VALUE : type };
1387
+ }
1388
+
1389
+ @ Override
1390
+ protected void postprocessCArguments (VirtualFrame frame , Object [] cArguments ) {
1391
+ ReleaseNativeWrapperNode releaseNativeWrapperNode = ensureReleaseNativeWrapperNode ();
1392
+ releaseNativeWrapperNode .execute (cArguments [0 ]);
1393
+ releaseNativeWrapperNode .execute (cArguments [1 ]);
1394
+ releaseNativeWrapperNode .execute (cArguments [2 ]);
1395
+ }
1396
+
1397
+ @ Override
1398
+ public Signature getSignature () {
1399
+ return SIGNATURE ;
1400
+ }
1401
+ }
1402
+
1360
1403
/**
1361
1404
* Implement mapping of {@code __delitem__} to {@code mp_ass_subscript}. It handles adding the
1362
1405
* NULL 3rd argument.
0 commit comments