Skip to content

Commit 969e104

Browse files
msimacektimfel
authored andcommitted
Fix test failures
1 parent 910065a commit 969e104

20 files changed

+169
-151
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinConstructors.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3193,8 +3193,8 @@ Object initArgs(Object cls, Object[] args, @SuppressWarnings("unused") PKeyword[
31933193
@Builtin(name = "mappingproxy", constructsClass = PythonBuiltinClassType.PMappingproxy, isPublic = false, minNumOfPositionalArgs = 1, maxNumOfPositionalArgs = 2)
31943194
@GenerateNodeFactory
31953195
public abstract static class MappingproxyNode extends PythonBuiltinNode {
3196-
@Specialization
3197-
Object doMapping(Object klass, PythonObject obj,
3196+
@Specialization(guards = "!isNoValue(obj)")
3197+
Object doMapping(Object klass, Object obj,
31983198
@Cached PyMappingCheckNode mappingCheckNode) {
31993199
if (mappingCheckNode.execute(obj)) {
32003200
return factory().createMappingproxy(klass, obj);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinFunctions.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
import com.oracle.graal.python.lib.PyNumberIndexNode;
133133
import com.oracle.graal.python.lib.PyObjectAsciiNode;
134134
import com.oracle.graal.python.lib.PyObjectCallMethodObjArgs;
135+
import com.oracle.graal.python.lib.PyObjectGetAttr;
135136
import com.oracle.graal.python.lib.PyObjectHashNode;
136137
import com.oracle.graal.python.lib.PyObjectLookupAttr;
137138
import com.oracle.graal.python.lib.PyObjectReprAsObjectNode;
@@ -1553,24 +1554,24 @@ public abstract static class PrintNode extends PythonBuiltinNode {
15531554
@Specialization
15541555
@SuppressWarnings("unused")
15551556
PNone printNoKeywords(VirtualFrame frame, Object[] values, PNone sep, PNone end, PNone file, PNone flush,
1556-
@Shared("lookupWrite") @Cached PyObjectLookupAttr lookupWrite,
1557+
@Shared("getWriteMethod") @Cached PyObjectGetAttr getWriteMethod,
15571558
@Shared("callWrite") @Cached CallNode callWrite,
15581559
@Shared("callFlush") @Cached PyObjectCallMethodObjArgs callFlush,
15591560
@Shared("strNode") @Cached PyObjectStrAsObjectNode strNode) {
15601561
Object stdout = getStdout();
1561-
return printAllGiven(frame, values, DEFAULT_SEPARATOR, DEFAULT_END, stdout, false, lookupWrite, callWrite, callFlush, strNode);
1562+
return printAllGiven(frame, values, DEFAULT_SEPARATOR, DEFAULT_END, stdout, false, getWriteMethod, callWrite, callFlush, strNode);
15621563
}
15631564

15641565
@Specialization(guards = {"!isNone(file)", "!isNoValue(file)"})
1565-
PNone printAllGiven(VirtualFrame frame, Object[] values, String sep, String end, Object file, boolean flush,
1566-
@Shared("lookupWrite") @Cached PyObjectLookupAttr lookupWrite,
1566+
static PNone printAllGiven(VirtualFrame frame, Object[] values, String sep, String end, Object file, boolean flush,
1567+
@Shared("getWriteMethod") @Cached PyObjectGetAttr getWriteMethod,
15671568
@Shared("callWrite") @Cached CallNode callWrite,
15681569
@Shared("callFlush") @Cached PyObjectCallMethodObjArgs callFlush,
15691570
@Shared("strNode") @Cached PyObjectStrAsObjectNode strNode) {
15701571
int lastValue = values.length - 1;
15711572
// Note: the separate lookup is necessary due to different __getattr__ treatment than
15721573
// method lookup
1573-
Object writeMethod = lookupWrite.executeStrict(frame, this, file, "write");
1574+
Object writeMethod = getWriteMethod.execute(frame, file, "write");
15741575
for (int i = 0; i < lastValue; i++) {
15751576
callWrite.execute(frame, writeMethod, strNode.execute(frame, values[i]));
15761577
callWrite.execute(frame, writeMethod, sep);
@@ -1591,7 +1592,7 @@ PNone printGeneric(VirtualFrame frame, Object[] values, Object sepIn, Object end
15911592
@Cached CastToJavaStringNode castEnd,
15921593
@Cached("createIfTrueNode()") CoerceToBooleanNode castFlush,
15931594
@Cached PRaiseNode raiseNode,
1594-
@Shared("lookupWrite") @Cached PyObjectLookupAttr lookupWrite,
1595+
@Shared("getWriteMethod") @Cached PyObjectGetAttr getWriteMethod,
15951596
@Shared("callWrite") @Cached CallNode callWrite,
15961597
@Shared("callFlush") @Cached PyObjectCallMethodObjArgs callFlush,
15971598
@Shared("strNode") @Cached PyObjectStrAsObjectNode strNode) {
@@ -1621,7 +1622,7 @@ PNone printGeneric(VirtualFrame frame, Object[] values, Object sepIn, Object end
16211622
} else {
16221623
flush = castFlush.executeBoolean(frame, flushIn);
16231624
}
1624-
return printAllGiven(frame, values, sep, end, file, flush, lookupWrite, callWrite, callFlush, strNode);
1625+
return printAllGiven(frame, values, sep, end, file, flush, getWriteMethod, callWrite, callFlush, strNode);
16251626
}
16261627

16271628
private Object getStdout() {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/JavaModuleBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
import com.oracle.graal.python.builtins.objects.module.PythonModule;
5959
import com.oracle.graal.python.builtins.objects.str.PString;
6060
import com.oracle.graal.python.lib.PyObjectCallMethodObjArgs;
61-
import com.oracle.graal.python.lib.PyObjectLookupAttr;
61+
import com.oracle.graal.python.lib.PyObjectGetAttr;
6262
import com.oracle.graal.python.nodes.ErrorMessages;
6363
import com.oracle.graal.python.nodes.call.CallNode;
6464
import com.oracle.graal.python.nodes.function.PythonBuiltinBaseNode;
@@ -271,7 +271,7 @@ abstract static class GetAttrNode extends PythonBuiltinNode {
271271
private Object getAttr(VirtualFrame frame, PythonModule mod) {
272272
if (getAttr == null) {
273273
CompilerDirectives.transferToInterpreterAndInvalidate();
274-
Object javaLoader = PyObjectLookupAttr.getUncached().executeStrict(frame, this, mod, JAVA_PKG_LOADER);
274+
Object javaLoader = PyObjectGetAttr.getUncached().execute(frame, mod, JAVA_PKG_LOADER);
275275
getAttr = PyObjectCallMethodObjArgs.getUncached().execute(frame, javaLoader, MAKE_GETATTR, JAVA);
276276
}
277277
return getAttr;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/io/IOBaseBuiltins.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
import com.oracle.graal.python.builtins.objects.object.PythonObject;
9090
import com.oracle.graal.python.builtins.objects.object.PythonObjectLibrary;
9191
import com.oracle.graal.python.lib.PyObjectCallMethodObjArgs;
92+
import com.oracle.graal.python.lib.PyObjectGetAttr;
9293
import com.oracle.graal.python.lib.PyObjectIsTrueNode;
9394
import com.oracle.graal.python.lib.PyObjectLookupAttr;
9495
import com.oracle.graal.python.lib.PyObjectSizeNode;
@@ -174,9 +175,9 @@ static boolean writable(@SuppressWarnings("unused") PythonObject self) {
174175
abstract static class CheckClosedNode extends PythonUnaryBuiltinNode {
175176
@Specialization
176177
Object doCheckClosed(VirtualFrame frame, PythonObject self,
177-
@Cached PyObjectLookupAttr lookupAttr,
178+
@Cached PyObjectGetAttr getAttr,
178179
@Cached PyObjectIsTrueNode isTrueNode) {
179-
if (isTrueNode.execute(frame, lookupAttr.executeStrict(frame, this, self, CLOSED))) {
180+
if (isTrueNode.execute(frame, getAttr.execute(frame, self, CLOSED))) {
180181
throw raise(ValueError, ErrorMessages.IO_CLOSED);
181182
}
182183
return PNone.NONE;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/io/TextIOWrapperBuiltins.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
import com.oracle.graal.python.lib.PyNumberAsSizeNode;
123123
import com.oracle.graal.python.lib.PyNumberIndexNode;
124124
import com.oracle.graal.python.lib.PyObjectCallMethodObjArgs;
125+
import com.oracle.graal.python.lib.PyObjectGetAttr;
125126
import com.oracle.graal.python.lib.PyObjectIsTrueNode;
126127
import com.oracle.graal.python.lib.PyObjectLookupAttr;
127128
import com.oracle.graal.python.lib.PyObjectSizeNode;
@@ -1056,19 +1057,19 @@ static Object finalizing(PTextIO self) {
10561057
@GenerateNodeFactory
10571058
abstract static class NameNode extends AttachedCheckPythonUnaryBuiltinNode {
10581059
@Specialization(guards = "checkAttached(self)")
1059-
Object name(VirtualFrame frame, PTextIO self,
1060-
@Cached PyObjectLookupAttr lookupAttr) {
1061-
return lookupAttr.executeStrict(frame, this, self.getBuffer(), NAME);
1060+
static Object name(VirtualFrame frame, PTextIO self,
1061+
@Cached PyObjectGetAttr getAttr) {
1062+
return getAttr.execute(frame, self.getBuffer(), NAME);
10621063
}
10631064
}
10641065

10651066
@Builtin(name = CLOSED, minNumOfPositionalArgs = 1, isGetter = true)
10661067
@GenerateNodeFactory
10671068
abstract static class ClosedNode extends AttachedCheckPythonUnaryBuiltinNode {
10681069
@Specialization(guards = "checkAttached(self)")
1069-
Object closed(VirtualFrame frame, PTextIO self,
1070-
@Cached PyObjectLookupAttr lookupAttr) {
1071-
return lookupAttr.executeStrict(frame, this, self.getBuffer(), CLOSED);
1070+
static Object closed(VirtualFrame frame, PTextIO self,
1071+
@Cached PyObjectGetAttr lookupAttr) {
1072+
return lookupAttr.execute(frame, self.getBuffer(), CLOSED);
10721073
}
10731074
}
10741075

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/io/TextIOWrapperNodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
import com.oracle.graal.python.builtins.objects.str.PString;
7171
import com.oracle.graal.python.builtins.objects.tuple.PTuple;
7272
import com.oracle.graal.python.lib.PyNumberAsSizeNode;
73+
import com.oracle.graal.python.lib.PyObjectGetAttr;
7374
import com.oracle.graal.python.lib.PyObjectIsTrueNode;
74-
import com.oracle.graal.python.lib.PyObjectLookupAttr;
7575
import com.oracle.graal.python.nodes.ErrorMessages;
7676
import com.oracle.graal.python.nodes.PNodeWithRaise;
7777
import com.oracle.graal.python.nodes.PRaiseNode;
@@ -168,10 +168,10 @@ void error(@SuppressWarnings("unused") PTextIO self) {
168168

169169
@Specialization(guards = "!self.isFileIO()")
170170
void checkGeneric(VirtualFrame frame, PTextIO self,
171-
@Cached PyObjectLookupAttr lookupAttr,
171+
@Cached PyObjectGetAttr getAttr,
172172
@Cached PyObjectIsTrueNode isTrueNode,
173173
@Cached ConditionProfile isError) {
174-
Object res = lookupAttr.executeStrict(frame, this, self.getBuffer(), CLOSED);
174+
Object res = getAttr.execute(frame, self.getBuffer(), CLOSED);
175175
if (isError.profile(isTrueNode.execute(frame, res))) {
176176
error(self);
177177
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/array/ArrayBuiltins.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
import com.oracle.graal.python.builtins.objects.tuple.PTuple;
7979
import com.oracle.graal.python.lib.PyNumberIndexNode;
8080
import com.oracle.graal.python.lib.PyObjectCallMethodObjArgs;
81+
import com.oracle.graal.python.lib.PyObjectGetAttr;
8182
import com.oracle.graal.python.lib.PyObjectLookupAttr;
8283
import com.oracle.graal.python.lib.PyObjectSizeNode;
8384
import com.oracle.graal.python.nodes.builtins.ListNodes;
@@ -678,7 +679,7 @@ Object reduceLegacy(VirtualFrame frame, PArray self, @SuppressWarnings("unused")
678679
Object reduce(VirtualFrame frame, PArray self, @SuppressWarnings("unused") int protocol,
679680
@Cached GetClassNode getClassNode,
680681
@Cached PyObjectLookupAttr lookupDict,
681-
@Cached PyObjectLookupAttr lookupReconstructor,
682+
@Cached PyObjectGetAttr getReconstructor,
682683
@Cached ToBytesNode toBytesNode) {
683684
PythonModule arrayModule = getCore().lookupBuiltinModule("array");
684685
PArray.MachineFormat mformat = PArray.MachineFormat.forFormat(self.getFormat());
@@ -688,7 +689,7 @@ Object reduce(VirtualFrame frame, PArray self, @SuppressWarnings("unused") int p
688689
if (dict == PNone.NO_VALUE) {
689690
dict = PNone.NONE;
690691
}
691-
Object reconstructor = lookupReconstructor.executeStrict(frame, this, arrayModule, "_array_reconstructor");
692+
Object reconstructor = getReconstructor.execute(frame, arrayModule, "_array_reconstructor");
692693
PTuple args = factory().createTuple(new Object[]{cls, self.getFormatString(), mformat.code, toBytesNode.call(frame, self)});
693694
return factory().createTuple(new Object[]{reconstructor, args, dict});
694695
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/function/AbstractFunctionBuiltins.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
import com.oracle.graal.python.builtins.objects.module.PythonModule;
5555
import com.oracle.graal.python.builtins.objects.object.PythonObject;
5656
import com.oracle.graal.python.builtins.objects.tuple.PTuple;
57-
import com.oracle.graal.python.lib.PyObjectLookupAttr;
57+
import com.oracle.graal.python.lib.PyObjectGetAttr;
5858
import com.oracle.graal.python.nodes.ErrorMessages;
5959
import com.oracle.graal.python.nodes.argument.CreateArgumentsNode;
6060
import com.oracle.graal.python.nodes.attributes.ReadAttributeFromObjectNode;
@@ -350,9 +350,9 @@ public static TextSignatureNode create() {
350350
public abstract static class ReduceNode extends PythonBuiltinNode {
351351
@Specialization
352352
Object doBuiltinFunc(VirtualFrame frame, PBuiltinFunction func, @SuppressWarnings("unused") Object obj,
353-
@Cached PyObjectLookupAttr lookupAttr) {
353+
@Cached PyObjectGetAttr getAttr) {
354354
PythonModule builtins = getCore().getBuiltins();
355-
Object getattr = lookupAttr.executeStrict(frame, this, builtins, GETATTR);
355+
Object getattr = getAttr.execute(frame, builtins, GETATTR);
356356
PTuple args = factory().createTuple(new Object[]{func.getEnclosingType(), func.getName()});
357357
return factory().createTuple(new Object[]{getattr, args});
358358
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/iterator/IteratorBuiltins.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
import com.oracle.graal.python.builtins.objects.range.RangeNodes.LenOfRangeNode;
5656
import com.oracle.graal.python.builtins.objects.tuple.PTuple;
5757
import com.oracle.graal.python.lib.PyNumberAsSizeNode;
58-
import com.oracle.graal.python.lib.PyObjectLookupAttr;
58+
import com.oracle.graal.python.lib.PyObjectGetAttr;
5959
import com.oracle.graal.python.lib.PyObjectSizeNode;
6060
import com.oracle.graal.python.nodes.ErrorMessages;
6161
import com.oracle.graal.python.nodes.call.special.LookupAndCallBinaryNode;
@@ -359,7 +359,7 @@ public static int lengthHint(VirtualFrame frame, PSequenceIterator self,
359359
@Builtin(name = __REDUCE__, minNumOfPositionalArgs = 1)
360360
@GenerateNodeFactory
361361
public abstract static class ReduceNode extends PythonUnaryBuiltinNode {
362-
@Child PyObjectLookupAttr lookupAttrNode;
362+
@Child PyObjectGetAttr getAttrNode;
363363

364364
@Specialization
365365
public Object reduce(VirtualFrame frame, PArrayIterator self,
@@ -470,7 +470,7 @@ private PTuple reduceInternal(VirtualFrame frame, Object arg, PythonContext cont
470470

471471
private PTuple reduceInternal(VirtualFrame frame, Object arg, Object state, PythonContext context) {
472472
PythonModule builtins = context.getCore().getBuiltins();
473-
Object iter = getLookupAttrNode().executeStrict(frame, this, builtins, ITER);
473+
Object iter = getGetAttrNode().execute(frame, builtins, ITER);
474474
PTuple args = factory().createTuple(new Object[]{arg});
475475
// callable, args, state (optional)
476476
if (state != null) {
@@ -480,12 +480,12 @@ private PTuple reduceInternal(VirtualFrame frame, Object arg, Object state, Pyth
480480
}
481481
}
482482

483-
private PyObjectLookupAttr getLookupAttrNode() {
484-
if (lookupAttrNode == null) {
483+
private PyObjectGetAttr getGetAttrNode() {
484+
if (getAttrNode == null) {
485485
CompilerDirectives.transferToInterpreterAndInvalidate();
486-
lookupAttrNode = insert(PyObjectLookupAttr.create());
486+
getAttrNode = insert(PyObjectGetAttr.create());
487487
}
488-
return lookupAttrNode;
488+
return getAttrNode;
489489
}
490490
}
491491

0 commit comments

Comments
 (0)