Skip to content

Commit cccf500

Browse files
committed
fix interop tests
1 parent eac794f commit cccf500

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/interop/JavaInteropTest.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import java.io.IOException;
5151
import java.io.UnsupportedEncodingException;
5252
import java.util.Arrays;
53-
import java.util.List;
5453

5554
import org.graalvm.polyglot.Context;
5655
import org.graalvm.polyglot.Context.Builder;
@@ -300,22 +299,17 @@ public void accessSuitePy() throws IOException {
300299
"}",
301300
"suite.py").build();
302301
Value suite = context.eval(suitePy);
303-
304-
Value listConverter = context.eval("python", "list");
305-
Value libraries = suite.getMember("libraries");
302+
Value libraries = suite.getHashValue("libraries");
306303
assertNotNull("libraries found", libraries);
307-
final List<Object> suiteKeys = Arrays.asList(listConverter.execute(suite.invokeMember("keys")).as(Object[].class));
308-
assertTrue("Libraries found among keys: " + suiteKeys, suiteKeys.contains("libraries"));
309-
310304
Value dacapo = null;
311-
for (Object k : listConverter.execute(libraries.invokeMember("keys")).as(List.class)) {
305+
for (Object k : libraries.getHashKeysIterator().as(Iterable.class)) {
312306
System.err.println("k " + k);
313307
if ("DACAPO".equals(k)) {
314-
dacapo = libraries.getMember((String) k);
308+
dacapo = libraries.getHashValue(k);
315309
}
316310
}
317311
assertNotNull("Dacapo found", dacapo);
318-
assertEquals("'e39957904b7e79caf4fa54f30e8e4ee74d4e9e37'", dacapo.getMember("sha1").toString());
312+
assertEquals("'e39957904b7e79caf4fa54f30e8e4ee74d4e9e37'", dacapo.getHashValue("sha1").toString());
319313
}
320314

321315
@ExportLibrary(InteropLibrary.class)

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/PythonAbstractObject.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,9 +1461,10 @@ static boolean access(Object object, String attrKeyName, int type,
14611461
// can only modify if the object is not immutable
14621462
return !isImmutable.execute(owner);
14631463
} else if (getSetNode.execute(attr, __SET__) == PNone.NO_VALUE) {
1464-
// an inherited attribute may be overridable unless it's a setter,
1465-
// than we don't know
1464+
// an inherited attribute may be overridable unless it's a setter
14661465
return !isImmutable.execute(object);
1466+
} else if (getSetNode.execute(attr, __SET__) != PNone.NO_VALUE) {
1467+
return true;
14671468
}
14681469
}
14691470
return false;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/foreign/ForeignObjectBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ protected Object doIt(Object object,
771771
@GenerateNodeFactory
772772
abstract static class IndexNode extends PythonUnaryBuiltinNode {
773773
@Specialization(limit = "3")
774-
protected static Object doIt(Object object,
774+
protected static long doIt(Object object,
775775
@Cached PRaiseNode raiseNode,
776776
@CachedLibrary("object") InteropLibrary lib) {
777777
if (lib.isBoolean(object)) {

0 commit comments

Comments
 (0)