mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 20:06:12 +00:00
Fix error handling in Python API, minor cleanup
This commit is contained in:
parent
ec55e40d5e
commit
06dffde0fe
@ -59,7 +59,7 @@ def launch_ipykernel(argv):
|
|||||||
|
|
||||||
def run_kernel():
|
def run_kernel():
|
||||||
app.kernel_class = CutterIPythonKernel
|
app.kernel_class = CutterIPythonKernel
|
||||||
app.log_level = logging.DEBUG
|
#app.log_level = logging.DEBUG
|
||||||
app.initialize(argv[3:])
|
app.initialize(argv[3:])
|
||||||
app.start()
|
app.start()
|
||||||
|
|
||||||
|
@ -58,7 +58,9 @@ PyObject *api_internal_launch_ipykernel(PyObject *self, PyObject *args, PyObject
|
|||||||
if (!PyArg_ParseTuple(args, "O", &argvListObject)
|
if (!PyArg_ParseTuple(args, "O", &argvListObject)
|
||||||
|| !PyList_Check(argvListObject))
|
|| !PyList_Check(argvListObject))
|
||||||
{
|
{
|
||||||
qWarning() << "Invalid args passed to api_internal_launch_ipykernel().";
|
const char *msg = "Invalid args passed to api_internal_launch_ipykernel().";
|
||||||
|
qWarning() << msg;
|
||||||
|
PyErr_SetString(PyExc_RuntimeError, msg);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +83,9 @@ PyObject *api_internal_kernel_interface_send_signal(PyObject *, PyObject *args)
|
|||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "ll", &id, &signum))
|
if (!PyArg_ParseTuple(args, "ll", &id, &signum))
|
||||||
{
|
{
|
||||||
qWarning() << "Invalid args passed to api_internal_kernel_interface_send_signal().";
|
const char *msg = "Invalid args passed to api_internal_kernel_interface_send_signal().";
|
||||||
|
qWarning() << msg;
|
||||||
|
PyErr_SetString(PyExc_RuntimeError, msg);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +104,9 @@ PyObject *api_internal_kernel_interface_poll(PyObject *, PyObject *args)
|
|||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "l", &id))
|
if (!PyArg_ParseTuple(args, "l", &id))
|
||||||
{
|
{
|
||||||
qWarning() << "Invalid args passed to api_internal_kernel_interface_poll().";
|
const char *msg = "Invalid args passed to api_internal_kernel_interface_poll().";
|
||||||
|
qWarning() << msg;
|
||||||
|
PyErr_SetString(PyExc_RuntimeError, msg);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,14 +136,13 @@ PyObject *api_internal_thread_set_async_exc(PyObject *, PyObject *args)
|
|||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "lO", &id, &exc))
|
if (!PyArg_ParseTuple(args, "lO", &id, &exc))
|
||||||
{
|
{
|
||||||
qWarning() << "Invalid args passed to api_internal_set_async_exc().";
|
const char *msg = "Invalid args passed to api_internal_thread_set_async_exc().";
|
||||||
|
qWarning() << msg;
|
||||||
|
PyErr_SetString(PyExc_RuntimeError, msg);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("setasyncexc %ld\n", id);
|
|
||||||
int ret = PyThreadState_SetAsyncExc(id, exc);
|
int ret = PyThreadState_SetAsyncExc(id, exc);
|
||||||
printf("%d threads affected\n", ret);
|
|
||||||
|
|
||||||
return PyLong_FromLong(ret);
|
return PyLong_FromLong(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user