41
41
package com .oracle .graal .python .builtins .modules .cext ;
42
42
43
43
import static com .oracle .graal .python .builtins .PythonBuiltinClassType .TypeError ;
44
- import static com .oracle .graal .python .nodes .ErrorMessages .RETURNED_NONBYTES ;
45
44
import static com .oracle .graal .python .nodes .ErrorMessages .UNHASHABLE_TYPE_P ;
46
45
import static com .oracle .graal .python .nodes .SpecialMethodNames .__BYTES__ ;
47
46
67
66
import com .oracle .graal .python .builtins .objects .cext .capi .CExtNodes .TransformExceptionToNativeNode ;
68
67
import com .oracle .graal .python .builtins .objects .function .PKeyword ;
69
68
import 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 ;
70
71
import com .oracle .graal .python .lib .PyObjectAsFileDescriptor ;
71
72
import com .oracle .graal .python .lib .PyObjectCallMethodObjArgs ;
72
73
import com .oracle .graal .python .lib .PyObjectDelItem ;
73
74
import com .oracle .graal .python .lib .PyObjectLookupAttr ;
74
75
import com .oracle .graal .python .lib .PyObjectReprAsObjectNode ;
75
76
import com .oracle .graal .python .lib .PyObjectSetItem ;
76
77
import com .oracle .graal .python .lib .PyObjectStrAsObjectNode ;
78
+ import static com .oracle .graal .python .nodes .ErrorMessages .RETURNED_NONBYTES ;
77
79
import com .oracle .graal .python .nodes .SpecialMethodNames ;
78
80
import static com .oracle .graal .python .nodes .SpecialMethodNames .__SETATTR__ ;
79
81
import com .oracle .graal .python .nodes .attributes .GetAttributeNode .GetAnyAttributeNode ;
80
82
import 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 ;
83
83
import com .oracle .graal .python .nodes .call .special .CallUnaryMethodNode ;
84
84
import com .oracle .graal .python .nodes .classes .IsSubtypeNode ;
85
85
import com .oracle .graal .python .nodes .expression .BinaryComparisonNode ;
@@ -483,12 +483,10 @@ Object asFileDescriptor(VirtualFrame frame, Object obj,
483
483
abstract static class PyObjectGenericGetAttrNode extends PythonBinaryBuiltinNode {
484
484
@ Specialization
485
485
Object getAttr (VirtualFrame frame , Object obj , Object attr ,
486
- @ Cached PyObjectLookupAttr lookupSetAttrNode ,
487
- @ Cached CallBinaryMethodNode callNode ,
486
+ @ Cached GetAttributeNode getAttrNode ,
488
487
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
489
488
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__ );
492
490
} catch (PException e ) {
493
491
transformExceptionToNativeNode .execute (frame , e );
494
492
return getContext ().getNativeNull ();
@@ -501,12 +499,10 @@ Object getAttr(VirtualFrame frame, Object obj, Object attr,
501
499
abstract static class PyObjectGenericSetAttrNode extends PythonTernaryBuiltinNode {
502
500
@ Specialization
503
501
int setAttr (VirtualFrame frame , Object obj , Object attr , Object value ,
504
- @ Cached PyObjectLookupAttr lookupSetAttrNode ,
505
- @ Cached CallTernaryMethodNode callNode ,
502
+ @ Cached SetattrNode setAttrNode ,
506
503
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
507
504
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 );
510
506
return 0 ;
511
507
} catch (PException e ) {
512
508
transformExceptionToNativeNode .execute (frame , e );
0 commit comments