Skip to content

Commit 7c27e40

Browse files
authored
[DRIVER] Use PyObject_CallOneArg instead of more general PyObject_CallObject where possible (#5101)
https://docs.python.org/3.10/c-api/call.html#c.PyObject_CallOneArg To align with other backends. Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 9a3b6eb commit 7c27e40

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

third_party/intel/backend/driver.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,7 @@ def format_of(ty):
742742
Py_DECREF(clusterDim);
743743
// extract launch metadata
744744
if (launch_enter_hook != Py_None){{
745-
PyObject* args = Py_BuildValue("(O)", launch_metadata);
746-
PyObject* ret = PyObject_CallObject(launch_enter_hook, args);
747-
Py_DECREF(args);
745+
PyObject* ret = PyObject_CallOneArg(launch_enter_hook, launch_metadata);
748746
if (!ret)
749747
return NULL;
750748
Py_DECREF(ret);
@@ -767,9 +765,7 @@ def format_of(ty):
767765
}}
768766
769767
if(launch_exit_hook != Py_None){{
770-
PyObject* args = Py_BuildValue("(O)", launch_metadata);
771-
PyObject* ret = PyObject_CallObject(launch_exit_hook, args);
772-
Py_DECREF(args);
768+
PyObject* ret = PyObject_CallOneArg(launch_exit_hook, launch_metadata);
773769
if (!ret)
774770
return NULL;
775771
Py_DECREF(ret);

0 commit comments

Comments
 (0)