Skip to content

Commit 5b6356c

Browse files
authored
Use limited Python API where possible (#568)
Use limited Python API to help address rapidsai/build-planning#42. Authors: - Peter Andreas Entschev (https://github.com/pentschev) - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Vyas Ramasubramani (https://github.com/vyasr) - https://github.com/jakirkham URL: #568
1 parent 41608f8 commit 5b6356c

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

cpp/python/src/future.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,7 @@ PyObject* create_python_future()
9595
future_object = get_asyncio_future_object();
9696
if (future_object == NULL) { goto finish; }
9797
if (!PyCallable_Check(future_object)) {
98-
PyErr_Format(PyExc_RuntimeError,
99-
"%s.%s is not callable.",
100-
PyUnicode_1BYTE_DATA(asyncio_str),
101-
PyUnicode_1BYTE_DATA(future_str));
98+
PyErr_Format(PyExc_RuntimeError, "%U.%U is not callable.", asyncio_str, future_str);
10299
goto finish;
103100
}
104101

@@ -251,10 +248,7 @@ PyObject* future_set_result_with_event_loop(PyObject* event_loop, PyObject* futu
251248
goto finish;
252249
}
253250
if (!PyCallable_Check(set_result_callable)) {
254-
PyErr_Format(PyExc_RuntimeError,
255-
"%s.%s is not callable.",
256-
PyUnicode_1BYTE_DATA(future),
257-
PyUnicode_1BYTE_DATA(set_result_str));
251+
PyErr_Format(PyExc_RuntimeError, "%R.%U is not callable.", future, set_result_str);
258252
goto finish;
259253
}
260254

@@ -306,10 +300,7 @@ PyObject* future_set_exception_with_event_loop(PyObject* event_loop,
306300
goto finish;
307301
}
308302
if (!PyCallable_Check(set_exception_callable)) {
309-
PyErr_Format(PyExc_RuntimeError,
310-
"%s.%s is not callable.",
311-
PyUnicode_1BYTE_DATA(future),
312-
PyUnicode_1BYTE_DATA(set_exception_str));
303+
PyErr_Format(PyExc_RuntimeError, "%R.%U is not callable.", future, set_exception_str);
313304
goto finish;
314305
}
315306

0 commit comments

Comments
 (0)