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).
This commit is contained in:
Victor Stinner 2023-07-03 12:48:50 +02:00 committed by GitHub
parent 18fedd04a7
commit c5afc97fc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 63 additions and 46 deletions

View file

@ -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 *);