/* 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);
/* In signalmodule.c */
int PySignal_SetWakeupFd(int fd);
-PyAPI_FUNC(int) _PyErr_CheckSignals(void);
/* Support for adding program text to SyntaxErrors */
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);
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))
#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 *);
#include "Python.h"
#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_object.h"
+#include "pycore_pyerrors.h" // _Py_FatalErrorFormat()
#include "structmember.h" // PyMemberDef
#include "_iomodule.h"
* 3. This notice may not be removed or altered from any source distribution.
*/
+#ifndef Py_BUILD_CORE_BUILTIN
+# define Py_BUILD_CORE_MODULE 1
+#endif
+
#include "cursor.h"
#include "microprotocols.h"
#include "module.h"
#include "util.h"
+#include "pycore_pyerrors.h" // _PyErr_FormatFromCause()
+
typedef enum {
TYPE_LONG,
TYPE_FLOAT,
#include "Python.h"
#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_interp.h" // PyInterpreterState.importlib
-#include "pycore_object.h" // _PyType_AllocNoTrack
-#include "pycore_moduleobject.h" // _PyModule_GetDef()
#include "pycore_modsupport.h" // _PyModule_CreateInitialized()
+#include "pycore_moduleobject.h" // _PyModule_GetDef()
+#include "pycore_object.h" // _PyType_AllocNoTrack
+#include "pycore_pyerrors.h" // _PyErr_FormatFromCause()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "structmember.h" // PyMemberDef
#include "Python.h"
#include "pycore_code.h" // stats
-#include "pycore_pystate.h" // _PyInterpreterState_GET
-
#include "pycore_obmalloc.h"
+#include "pycore_pyerrors.h" // _Py_FatalErrorFormat()
#include "pycore_pymem.h"
+#include "pycore_pystate.h" // _PyInterpreterState_GET
#include <stdlib.h> // malloc()
#include <stdbool.h>
#include "pycore_long.h" // _PyLong_FormatWriter()
#include "pycore_object.h" // _PyObject_GC_TRACK(), _Py_FatalRefcountError()
#include "pycore_pathconfig.h" // _Py_DumpPathConfig()
+#include "pycore_pyerrors.h" // _PyUnicodeTranslateError_Create()
#include "pycore_pylifecycle.h" // _Py_SetFileSystemEncoding()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_ucnhash.h" // _PyUnicode_Name_CAPI
#include <Python.h>
#include <errcode.h>
+#include "pycore_pyerrors.h" // _PyErr_ProgramDecodedTextObject()
#include "tokenizer.h"
#include "pegen.h"
#include "Python.h"
#include "pycore_call.h"
#include "pycore_import.h"
+#include "pycore_pyerrors.h" // _PyErr_FormatFromCause()
#include "pycore_pystate.h"
#include "pycore_runtime.h"