summaryrefslogtreecommitdiff
path: root/Include/pyerrors.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/pyerrors.h')
-rw-r--r--Include/pyerrors.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index e38512307e..6a8e0e810e 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -75,6 +75,7 @@ typedef PyOSErrorObject PyWindowsErrorObject;
PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
+PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
PyAPI_FUNC(void) PyErr_SetString(
PyObject *exception,
const char *string /* decoded from utf-8 */
@@ -284,6 +285,28 @@ PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
const char *name, const char *doc, PyObject *base, PyObject *dict);
PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
+/* In exceptions.c */
+#ifndef Py_LIMITED_API
+/* Helper that attempts to replace the current exception with one of the
+ * same type but with a prefix added to the exception text. The resulting
+ * exception description looks like:
+ *
+ * prefix (exc_type: original_exc_str)
+ *
+ * Only some exceptions can be safely replaced. If the function determines
+ * it isn't safe to perform the replacement, it will leave the original
+ * unmodified exception in place.
+ *
+ * Returns a borrowed reference to the new exception (if any), NULL if the
+ * existing exception was left in place.
+ */
+PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause(
+ const char *prefix_format, /* ASCII-encoded string */
+ ...
+ );
+#endif
+
+
/* In sigcheck.c or signalmodule.c */
PyAPI_FUNC(int) PyErr_CheckSignals(void);
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
@@ -301,9 +324,16 @@ PyAPI_FUNC(void) PyErr_SyntaxLocationEx(
const char *filename, /* decoded from the filesystem encoding */
int lineno,
int col_offset);
+PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
+ PyObject *filename,
+ int lineno,
+ int col_offset);
PyAPI_FUNC(PyObject *) PyErr_ProgramText(
const char *filename, /* decoded from the filesystem encoding */
int lineno);
+PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
+ PyObject *filename,
+ int lineno);
/* The following functions are used to create and modify unicode
exceptions from C */