Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ndrewh committed Aug 4, 2024
1 parent 0e12730 commit e6983e8
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pyda_core/pyda_core_py.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ static int check_exited(pyda_thread *t) {
}
return 0;
}
static void set_signal_error(pyda_thread *t) {
PyObject *tuple = PyTuple_New(1);
PyTuple_SetItem(tuple, 0, PyLong_FromLong(t->signal));
PyErr_SetObject(FatalSignalError, tuple);
}

static PyObject *
PydaProcess_run(PyObject* self, PyObject *noarg) {
Expand All @@ -257,9 +262,7 @@ PydaProcess_run(PyObject* self, PyObject *noarg) {
Py_END_ALLOW_THREADS

if (t->signal) {
PyObject *tuple = PyTuple_New(1);
PyTuple_SetItem(tuple, 0, PyLong_FromLong(t->signal));
PyErr_SetObject(FatalSignalError, tuple);
set_signal_error(t);
return NULL;
}

Expand Down Expand Up @@ -291,9 +294,7 @@ PydaProcess_run_until_io(PyObject* self, PyObject *noarg) {
}

if (t->signal) {
PyObject *tuple = PyTuple_New(1);
PyTuple_SetItem(tuple, 0, PyLong_FromLong(t->signal));
PyErr_SetObject(FatalSignalError, tuple);
set_signal_error(t);
return NULL;
}

Expand Down Expand Up @@ -350,9 +351,7 @@ PydaProcess_run_until_pc(PyObject* self, PyObject *args) {
}

if (t->signal) {
PyObject *tuple = PyTuple_New(1);
PyTuple_SetItem(tuple, 0, PyLong_FromLong(t->signal));
PyErr_SetObject(FatalSignalError, tuple);
set_signal_error(t);
return NULL;
}

Expand Down

0 comments on commit e6983e8

Please sign in to comment.