summaryrefslogtreecommitdiffstats
path: root/Python/clinic/sysmodule.c.h
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-01-13 12:35:58 (GMT)
committerGitHub <noreply@github.com>2022-01-13 12:35:58 (GMT)
commitc590b581bba517f81ced2e6f531ccc9e2e22eab5 (patch)
treef3c49f2fa4a5eb43d403be8d8a811ebfc11f33fe /Python/clinic/sysmodule.c.h
parent9c2ebb906d1c68c3d571b100c92ceb08805b94cd (diff)
downloadcpython-c590b581bba517f81ced2e6f531ccc9e2e22eab5.zip
cpython-c590b581bba517f81ced2e6f531ccc9e2e22eab5.tar.gz
cpython-c590b581bba517f81ced2e6f531ccc9e2e22eab5.tar.bz2
bpo-46328: Add sys.exception() (GH-30514)
Diffstat (limited to 'Python/clinic/sysmodule.c.h')
-rw-r--r--Python/clinic/sysmodule.c.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h
index 8350fbf..ce5390c 100644
--- a/Python/clinic/sysmodule.c.h
+++ b/Python/clinic/sysmodule.c.h
@@ -76,6 +76,28 @@ exit:
return return_value;
}
+PyDoc_STRVAR(sys_exception__doc__,
+"exception($module, /)\n"
+"--\n"
+"\n"
+"Return the current exception.\n"
+"\n"
+"Return the most recent exception caught by an except clause\n"
+"in the current stack frame or in an older stack frame, or None\n"
+"if no such exception exists.");
+
+#define SYS_EXCEPTION_METHODDEF \
+ {"exception", (PyCFunction)sys_exception, METH_NOARGS, sys_exception__doc__},
+
+static PyObject *
+sys_exception_impl(PyObject *module);
+
+static PyObject *
+sys_exception(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return sys_exception_impl(module);
+}
+
PyDoc_STRVAR(sys_exc_info__doc__,
"exc_info($module, /)\n"
"--\n"
@@ -992,4 +1014,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=855fc93b2347710b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=60756bc6f683e0c8 input=a9049054013a1b77]*/