Skip to content

Commit 678b424

Browse files
committed
Implement C API function PyCapsule_GetName.
1 parent 0627d90 commit 678b424

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,9 @@ int PyCapsule_IsValid(PyObject *o, const char *name) {
8383
return o != NULL && UPCALL_CEXT_I(_jls_PyCapsule_IsValid, native_to_java(o), name ? polyglot_from_string(name, SRC_CS) : native_to_java(Py_None));
8484
}
8585

86+
UPCALL_ID(PyCapsule_GetName);
87+
const char * PyCapsule_GetName(PyObject *o) {
88+
return as_char_pointer(UPCALL_CEXT_O(_jls_PyCapsule_GetName, native_to_java(o)));
89+
}
90+
91+

graalpython/lib-graalpython/python_cext.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,11 @@ def PyCapsule_IsValid(obj, name):
821821
obj.name == name)
822822

823823

824+
@may_raise
825+
def PyCapsule_GetName(obj):
826+
return obj.name
827+
828+
824829
def PyModule_AddObject(m, k, v):
825830
m.__dict__[k] = v
826831
return None

0 commit comments

Comments
 (0)