Skip to content

Commit 202d492

Browse files
committed
Implement C API function PyMethodDescr_Check
1 parent 6664c61 commit 202d492

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,7 @@ PyObject* PyDictProxy_New(PyObject *mapping) {
6161
return (PyObject*) UPCALL_CEXT_O(_jls_PyDictProxy_New, native_to_java(mapping));
6262
}
6363

64+
UPCALL_ID(PyMethodDescr_Check);
65+
int PyMethodDescr_Check(PyObject* method) {
66+
return UPCALL_CEXT_I(_jls_PyMethodDescr_Check, native_to_java(method));
67+
}

graalpython/lib-graalpython/python_cext.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,10 @@ def bound_function(*args, **kwargs):
966966
return bound_function
967967

968968

969+
def PyMethodDescr_Check(func):
970+
return 1 if isinstance(func, type(list.append)) else 0
971+
972+
969973
# corresponds to PyInstanceMethod_Type
970974
class instancemethod:
971975
def __init__(self, func):

0 commit comments

Comments
 (0)