Skip to content

Commit c623ad6

Browse files
committed
Adding test.
1 parent a865047 commit c623ad6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_builtin.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@ def test_divmod_complex(self):
3737
self.assertRaises(TypeError, divmod, c1, c2)
3838
self.assertRaises(TypeError, divmod, 10, c2)
3939
self.assertRaises(TypeError, divmod, c1, 10)
40+
41+
def test_getitem_typeerror(self):
42+
a = object()
43+
try:
44+
a[1]
45+
except TypeError :
46+
pass
47+
else:
48+
self.assertTrue(False)

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/subscript/GetItemNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public Object doSpecialObject(Object primary, Object index) {
6161
CompilerDirectives.transferToInterpreterAndInvalidate();
6262
callGetitemNode = insert(LookupAndCallBinaryNode.create(__GETITEM__, null, () -> new LookupAndCallBinaryNode.NotImplementedHandler() {
6363
@Override
64-
public Object execute(@SuppressWarnings("unused") Object arg, Object arg2) {
65-
throw raise(TypeError, "'%p' object is not subscriptable", arg2);
64+
public Object execute(Object arg, @SuppressWarnings("unused") Object arg2) {
65+
throw raise(TypeError, "'%p' object is not subscriptable", arg);
6666
}
6767
}));
6868
}

0 commit comments

Comments
 (0)