Skip to content

Commit 7d7ccda

Browse files
committed
provide PyMapping_Keys
1 parent af0b633 commit 7d7ccda

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ PyObject * PyMapping_GetItemString(PyObject *o, const char *key) {
266266
return UPCALL_CEXT_O(_jls_PyObject_GetItem, native_to_java(o), polyglot_from_string(key, SRC_CS));
267267
}
268268

269+
UPCALL_ID(PyMapping_Keys);
270+
PyObject * PyMapping_Keys(PyObject *o) {
271+
return UPCALL_CEXT_O(_jls_PyMapping_Keys, native_to_java(o));
272+
}
273+
269274
// taken from CPython "Objects/abstract.c"
270275
int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
271276
PyBufferProcs *pb = obj->ob_type->tp_as_buffer;

graalpython/lib-graalpython/python_cext.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,3 +1258,8 @@ def PySlice_GetIndicesEx(start, stop, step, length):
12581258
@may_raise
12591259
def PySlice_New(start, stop, step):
12601260
return slice(start, stop, step)
1261+
1262+
1263+
@may_raise
1264+
def PyMapping_Keys(obj):
1265+
return list(obj.keys())

0 commit comments

Comments
 (0)