Skip to content

Commit 954080d

Browse files
committed
add PyDict_Items
1 parent 6bd11c1 commit 954080d

File tree

6 files changed

+1124
-1114
lines changed

6 files changed

+1124
-1114
lines changed

graalpython/com.oracle.graal.python.cext/src/capi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,10 @@ PyAPI_FUNC(PyObject*) PyDict_GetItem(PyObject* a, PyObject* b) {
15651565
PyAPI_FUNC(PyObject*) PyDict_GetItemWithError(PyObject* a, PyObject* b) {
15661566
return GraalPyDict_GetItemWithError(a, b);
15671567
}
1568+
#undef PyDict_Items
1569+
PyAPI_FUNC(PyObject*) PyDict_Items(PyObject* a) {
1570+
return GraalPyDict_Items(a);
1571+
}
15681572
#undef PyDict_Keys
15691573
PyAPI_FUNC(PyObject*) PyDict_Keys(PyObject* a) {
15701574
return GraalPyDict_Keys(a);

graalpython/com.oracle.graal.python.cext/src/capi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ typedef struct {
129129
BUILTIN(PyDict_DelItem, int, PyObject*, PyObject*) \
130130
BUILTIN(PyDict_GetItem, PyObject*, PyObject*, PyObject*) \
131131
BUILTIN(PyDict_GetItemWithError, PyObject*, PyObject*, PyObject*) \
132+
BUILTIN(PyDict_Items, PyObject*, PyObject*) \
132133
BUILTIN(PyDict_Keys, PyObject*, PyObject*) \
133134
BUILTIN(PyDict_Merge, int, PyObject*, PyObject*, int) \
134135
BUILTIN(PyDict_New, PyObject*) \

graalpython/com.oracle.graal.python.jni/src/capi_forwards.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,8 @@ PyAPI_FUNC(PyObject*) PyDict_GetItemWithError(PyObject* a, PyObject* b) {
21062106
return result;
21072107
}
21082108
PyAPI_FUNC(PyObject*) PyDict_Items(PyObject* a) {
2109-
unimplemented("PyDict_Items"); exit(-1);
2109+
PyObject* result = (PyObject*) GraalPyDict_Items(a);
2110+
return result;
21102111
}
21112112
PyAPI_FUNC(PyObject*) PyDict_Keys(PyObject* a) {
21122113
PyObject* result = (PyObject*) GraalPyDict_Keys(a);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextAbstractBuiltins.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ private static PList getKeys(VirtualFrame frame, Object obj, PyObjectGetAttr get
825825
return listNode.execute(frame, callNode.execute(frame, attr));
826826
}
827827

828+
@CApiBuiltin(name = "PyDict_Items", ret = PyObjectTransfer, args = {PyObject}, call = Direct)
828829
@CApiBuiltin(ret = PyObjectTransfer, args = {PyObject}, call = Direct)
829830
abstract static class PyMapping_Items extends CApiUnaryBuiltinNode {
830831
@Specialization

0 commit comments

Comments
 (0)