Skip to content

Commit 1bf578b

Browse files
committed
Also provide NFI callback for ctx_From/AsPyObject
1 parent 9a3c381 commit 1bf578b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • graalpython/com.oracle.graal.python.cext/hpy

graalpython/com.oracle.graal.python.cext/hpy/hpy.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,14 +1179,15 @@ HPyAPI_STORAGE HPy _HPy_IMPL_NAME(Tuple_FromArray)(HPyContext ctx, _HPyPtr items
11791179

11801180
HPyAPI_STORAGE HPy _HPy_IMPL_NAME_NOPREFIX(FromPyObject)(HPyContext ctx, cpy_PyObject *obj)
11811181
{
1182-
UPCALL_VOID(ctx_Err_SetString, ctx, UNWRAP(g_universal_ctx->h_SyntaxError), "API function 'ctx_FromPyObject not supported in ABI compatibility mode");
1183-
return HPy_NULL;
1182+
/* Although, this operation is not supported for in ABI compatibility mode, we still
1183+
need to implement the callback properly because it might still be a valid path
1184+
in other modes. */
1185+
return UPCALL_HPY(ctx_FromPyObject, ctx, obj);
11841186
}
11851187

11861188
HPyAPI_STORAGE cpy_PyObject *_HPy_IMPL_NAME_NOPREFIX(AsPyObject)(HPyContext ctx, HPy h)
11871189
{
1188-
UPCALL_VOID(ctx_Err_SetString, ctx, UNWRAP(g_universal_ctx->h_SyntaxError), "API function 'ctx_AsPyObject not supported in ABI compatibility mode");
1189-
return NULL;
1190+
return (cpy_PyObject *) UPCALL_CHARPTR(ctx_AsPyObject, ctx, h);
11901191
}
11911192

11921193
HPyAPI_STORAGE HPyListBuilder _HPy_IMPL_NAME(ListBuilder_New)(HPyContext ctx, HPy_ssize_t initial_size) {

0 commit comments

Comments
 (0)