8000 Use HPy_Call in __HPyArray_GenericHelper and hpy_npy_ctypes_check · mattip/numpy@868ee22 · GitHub
[go: up one dir, main page]

Skip to content

Commit 868ee22

Browse files
committed
Use HPy_Call in __HPyArray_GenericHelper and hpy_npy_ctypes_check
1 parent fe390fe commit 868ee22

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

numpy/core/src/common/npy_ctypes.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ hpy_npy_ctypes_check(HPyContext *ctx, HPy /* PyTypeObject * */ obj)
6060
goto fail;
6161
}
6262

63-
HPy args = HPyTuple_Pack(ctx, 1, obj);
64-
ret_obj = HPy_CallTupleDict(ctx, py_func, args, HPy_NULL); // PyObject_CallFunctionObjArgs
63+
ret_obj = HPy_Call(ctx, py_func, &obj, 1, HPy_NULL); // PyObject_CallFunctionObjArgs
6564
if (HPy_IsNull(ret_obj)) {
6665
goto fail;
6766
}

numpy/core/src/multiarray/number.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,11 @@ PyArray_GenericBinaryFunction(PyObject *m1, PyObject *m2, PyObject *op)
316316
return PyObject_CallFunctionObjArgs(op, m1, m2, NULL);
317317
}
318318

319-
static NPY_NO_EXPORT HPy
319+
static inline HPy
320320
__HPyArray_GenericHelper(HPyContext *ctx, HPyGlobal op, size_t n_args, HPy args[]) {
321321

322-
HPy args_tuple = HPyTuple_FromArray(ctx, args, n_args);
323322
HPy callable = HPyGlobal_Load(ctx, op);
324-
HPy res = HPy_CallTupleDict(ctx, callable, args_tuple, HPy_NULL);
325-
HPy_Close(ctx, args_tuple);
323+
HPy res = HPy_Call(ctx, callable, args, n_args, HPy_NULL);
326324
HPy_Close(ctx, callable);
327325
return res;
328326
}

0 commit comments

Comments
 (0)
0