4141package com .oracle .graal .python .builtins .modules .cext ;
4242
4343import static com .oracle .graal .python .builtins .PythonBuiltinClassType .TypeError ;
44- import static com .oracle .graal .python .nodes .ErrorMessages .RETURNED_NONBYTES ;
4544import static com .oracle .graal .python .nodes .ErrorMessages .UNHASHABLE_TYPE_P ;
4645import static com .oracle .graal .python .nodes .SpecialMethodNames .__BYTES__ ;
4746
6766import com .oracle .graal .python .builtins .objects .cext .capi .CExtNodes .TransformExceptionToNativeNode ;
6867import com .oracle .graal .python .builtins .objects .function .PKeyword ;
6968import com .oracle .graal .python .builtins .objects .ints .PInt ;
69+ import com .oracle .graal .python .builtins .objects .object .ObjectBuiltins .GetAttributeNode ;
70+ import com .oracle .graal .python .builtins .objects .object .ObjectBuiltins .SetattrNode ;
7071import com .oracle .graal .python .lib .PyObjectAsFileDescriptor ;
7172import com .oracle .graal .python .lib .PyObjectCallMethodObjArgs ;
7273import com .oracle .graal .python .lib .PyObjectDelItem ;
7374import com .oracle .graal .python .lib .PyObjectLookupAttr ;
7475import com .oracle .graal .python .lib .PyObjectReprAsObjectNode ;
7576import com .oracle .graal .python .lib .PyObjectSetItem ;
7677import com .oracle .graal .python .lib .PyObjectStrAsObjectNode ;
78+ import static com .oracle .graal .python .nodes .ErrorMessages .RETURNED_NONBYTES ;
7779import com .oracle .graal .python .nodes .SpecialMethodNames ;
7880import static com .oracle .graal .python .nodes .SpecialMethodNames .__SETATTR__ ;
7981import com .oracle .graal .python .nodes .attributes .GetAttributeNode .GetAnyAttributeNode ;
8082import com .oracle .graal .python .nodes .call .CallNode ;
81- import com .oracle .graal .python .nodes .call .special .CallBinaryMethodNode ;
82- import com .oracle .graal .python .nodes .call .special .CallTernaryMethodNode ;
8383import com .oracle .graal .python .nodes .call .special .CallUnaryMethodNode ;
8484import com .oracle .graal .python .nodes .classes .IsSubtypeNode ;
8585import com .oracle .graal .python .nodes .expression .BinaryComparisonNode ;
@@ -483,12 +483,10 @@ Object asFileDescriptor(VirtualFrame frame, Object obj,
483483 abstract static class PyObjectGenericGetAttrNode extends PythonBinaryBuiltinNode {
484484 @ Specialization
485485 Object getAttr (VirtualFrame frame , Object obj , Object attr ,
486- @ Cached PyObjectLookupAttr lookupSetAttrNode ,
487- @ Cached CallBinaryMethodNode callNode ,
486+ @ Cached GetAttributeNode getAttrNode ,
488487 @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
489488 try {
490- Object setAttrCallable = lookupSetAttrNode .execute (frame , getCore ().lookupType (PythonBuiltinClassType .PythonObject ), SpecialMethodNames .__GETATTRIBUTE__ );
491- return callNode .executeObject (frame , setAttrCallable , obj , attr );
489+ return getAttrNode .execute (frame , getCore ().lookupType (PythonBuiltinClassType .PythonObject ), SpecialMethodNames .__GETATTRIBUTE__ );
492490 } catch (PException e ) {
493491 transformExceptionToNativeNode .execute (frame , e );
494492 return getContext ().getNativeNull ();
@@ -501,12 +499,10 @@ Object getAttr(VirtualFrame frame, Object obj, Object attr,
501499 abstract static class PyObjectGenericSetAttrNode extends PythonTernaryBuiltinNode {
502500 @ Specialization
503501 int setAttr (VirtualFrame frame , Object obj , Object attr , Object value ,
504- @ Cached PyObjectLookupAttr lookupSetAttrNode ,
505- @ Cached CallTernaryMethodNode callNode ,
502+ @ Cached SetattrNode setAttrNode ,
506503 @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
507504 try {
508- Object setAttrCallable = lookupSetAttrNode .execute (frame , getCore ().lookupType (PythonBuiltinClassType .PythonObject ), __SETATTR__ );
509- callNode .execute (frame , setAttrCallable , obj , attr , value );
505+ setAttrNode .execute (frame , getCore ().lookupType (PythonBuiltinClassType .PythonObject ), __SETATTR__ , value );
510506 return 0 ;
511507 } catch (PException e ) {
512508 transformExceptionToNativeNode .execute (frame , e );
0 commit comments