mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-35568: add 'raise_signal' function (GH-11335)
As in title, expose C `raise` function as `raise_function` in `signal` module. Also drop existing `raise_signal` in `_testcapi` module and replace all usages with new function. https://bugs.python.org/issue35568
This commit is contained in:
parent
e61cc481e0
commit
c24c6c2c93
10 changed files with 122 additions and 47 deletions
|
|
@ -3859,25 +3859,6 @@ exit:
|
|||
return res;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
test_raise_signal(PyObject* self, PyObject *args)
|
||||
{
|
||||
int signum, err;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i:raise_signal", &signum)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err = raise(signum);
|
||||
if (err)
|
||||
return PyErr_SetFromErrno(PyExc_OSError);
|
||||
|
||||
if (PyErr_CheckSignals() < 0)
|
||||
return NULL;
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* marshal */
|
||||
|
||||
static PyObject*
|
||||
|
|
@ -4908,8 +4889,6 @@ static PyMethodDef TestMethods[] = {
|
|||
{"docstring_with_signature_with_defaults",
|
||||
(PyCFunction)test_with_docstring, METH_NOARGS,
|
||||
docstring_with_signature_with_defaults},
|
||||
{"raise_signal",
|
||||
(PyCFunction)test_raise_signal, METH_VARARGS},
|
||||
{"call_in_temporary_c_thread", call_in_temporary_c_thread, METH_O,
|
||||
PyDoc_STR("set_error_class(error_class) -> None")},
|
||||
{"pymarshal_write_long_to_file",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue