mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
bpo-41435: Add sys._current_exceptions() function (GH-21689)
This adds a new function named sys._current_exceptions() which is equivalent ot sys._current_frames() except that it returns the exceptions currently handled by other threads. It is equivalent to calling sys.exc_info() for each running thread.
This commit is contained in:
parent
3d86d090dc
commit
64366fa9b3
7 changed files with 185 additions and 1 deletions
22
Python/clinic/sysmodule.c.h
generated
22
Python/clinic/sysmodule.c.h
generated
|
|
@ -801,6 +801,26 @@ sys__current_frames(PyObject *module, PyObject *Py_UNUSED(ignored))
|
|||
return sys__current_frames_impl(module);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(sys__current_exceptions__doc__,
|
||||
"_current_exceptions($module, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Return a dict mapping each thread\'s identifier to its current raised exception.\n"
|
||||
"\n"
|
||||
"This function should be used for specialized purposes only.");
|
||||
|
||||
#define SYS__CURRENT_EXCEPTIONS_METHODDEF \
|
||||
{"_current_exceptions", (PyCFunction)sys__current_exceptions, METH_NOARGS, sys__current_exceptions__doc__},
|
||||
|
||||
static PyObject *
|
||||
sys__current_exceptions_impl(PyObject *module);
|
||||
|
||||
static PyObject *
|
||||
sys__current_exceptions(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return sys__current_exceptions_impl(module);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(sys_call_tracing__doc__,
|
||||
"call_tracing($module, func, args, /)\n"
|
||||
"--\n"
|
||||
|
|
@ -945,4 +965,4 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored))
|
|||
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#define SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
|
||||
/*[clinic end generated code: output=87baa3357293ea65 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=bbc4963fe86a29d9 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue