summaryrefslogtreecommitdiffstats
path: root/Include
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
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')
-rw-r--r--Include/cpython/pyerrors.h42
-rw-r--r--Include/internal/pycore_pyerrors.h48
2 files changed, 48 insertions, 42 deletions
diff --git a/Include/cpython/pyerrors.h b/Include/cpython/pyerrors.h
index 156665c..5c12821 100644
--- a/Include/cpython/pyerrors.h
+++ b/Include/cpython/pyerrors.h
@@ -91,31 +91,14 @@ typedef PyOSErrorObject PyWindowsErrorObject;
/* Error handling definitions */
PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
-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 **);
/* Context manipulation (PEP 3134) */
Py_DEPRECATED(3.12) PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(void) _PyErr_ChainExceptions1(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 */
- ...
- );
-
/* In exceptions.c */
-PyAPI_FUNC(int) _PyException_AddNote(
- PyObject *exc,
- PyObject *note);
-
PyAPI_FUNC(PyObject*) PyUnstable_Exc_PrepReraiseStar(
PyObject *orig,
PyObject *excs);
@@ -123,7 +106,6 @@ PyAPI_FUNC(PyObject*) PyUnstable_Exc_PrepReraiseStar(
/* In signalmodule.c */
int PySignal_SetWakeupFd(int fd);
-PyAPI_FUNC(int) _PyErr_CheckSignals(void);
/* Support for adding program text to SyntaxErrors */
@@ -143,18 +125,6 @@ PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
PyObject *filename,
int lineno);
-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) _PyErr_WriteUnraisableMsg(
const char *err_msg,
PyObject *obj);
@@ -163,16 +133,4 @@ PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFunc(
const char *func,
const char *message);
-PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFormat(
- const char *func,
- const char *format,
- ...);
-
-extern PyObject *_PyErr_SetImportErrorWithNameFrom(
- PyObject *,
- PyObject *,
- PyObject *,
- PyObject *);
-
-
#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, (message))
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 *);