summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_pyerrors.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-03 10:48:50 (GMT)
committerGitHub <noreply@github.com>2023-07-03 10:48:50 (GMT)
commitc5afc97fc2f149758f597c21f65b4a1c770bb827 (patch)
tree8f85655985da6804d77f352ca7e90f4ecc96bc0c /Include/internal/pycore_pyerrors.h
parent18fedd04a7b4d54b5eb7a34a1e1c9ca42219f882 (diff)
downloadcpython-c5afc97fc2f149758f597c21f65b4a1c770bb827.zip
cpython-c5afc97fc2f149758f597c21f65b4a1c770bb827.tar.gz
cpython-c5afc97fc2f149758f597c21f65b4a1c770bb827.tar.bz2
gh-106320: Remove private _PyErr C API functions (#106356)
Remove private _PyErr C API functions: move them to the internal C API (pycore_pyerrors.h).
Diffstat (limited to 'Include/internal/pycore_pyerrors.h')
-rw-r--r--Include/internal/pycore_pyerrors.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/Include/internal/pycore_pyerrors.h b/Include/internal/pycore_pyerrors.h
index d75bef0..e3ba4b7 100644
--- a/Include/internal/pycore_pyerrors.h
+++ b/Include/internal/pycore_pyerrors.h
@@ -9,6 +9,54 @@ extern "C" {
#endif
+/* Error handling definitions */
+
+PyAPI_FUNC(_PyErr_StackItem*) _PyErr_GetTopmostException(PyThreadState *tstate);
+PyAPI_FUNC(PyObject*) _PyErr_GetHandledException(PyThreadState *);
+PyAPI_FUNC(void) _PyErr_SetHandledException(PyThreadState *, PyObject *);
+PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, PyObject **);
+
+/* Like PyErr_Format(), but saves current exception as __context__ and
+ __cause__.
+ */
+PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause(
+ PyObject *exception,
+ const char *format, /* ASCII-encoded string */
+ ...
+ );
+
+PyAPI_FUNC(int) _PyException_AddNote(
+ PyObject *exc,
+ PyObject *note);
+
+PyAPI_FUNC(int) _PyErr_CheckSignals(void);
+
+/* Support for adding program text to SyntaxErrors */
+
+PyAPI_FUNC(PyObject *) _PyErr_ProgramDecodedTextObject(
+ PyObject *filename,
+ int lineno,
+ const char* encoding);
+
+PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
+ PyObject *object,
+ Py_ssize_t start,
+ Py_ssize_t end,
+ const char *reason /* UTF-8 encoded string */
+ );
+
+PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFormat(
+ const char *func,
+ const char *format,
+ ...);
+
+extern PyObject *_PyErr_SetImportErrorWithNameFrom(
+ PyObject *,
+ PyObject *,
+ PyObject *,
+ PyObject *);
+
+
/* runtime lifecycle */
extern PyStatus _PyErr_InitTypes(PyInterpreterState *);