◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
37 changes: 7 additions & 30 deletions Include/cpython/coreconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,13 @@ typedef struct {
int exitcode;
} _PyInitError;

/* Almost all errors causing Python initialization to fail */
#ifdef _MSC_VER
/* Visual Studio 2015 doesn't implement C99 __func__ in C */
# define _Py_INIT_GET_FUNC() __FUNCTION__
#else
# define _Py_INIT_GET_FUNC() __func__
#endif

#define _Py_INIT_OK() \
(_PyInitError){._type = _Py_INIT_ERR_TYPE_OK,}
/* other fields are set to 0 */
#define _Py_INIT_ERR(ERR_MSG) \
(_PyInitError){ \
._type = _Py_INIT_ERR_TYPE_ERROR, \
._func = _Py_INIT_GET_FUNC(), \
.err_msg = (ERR_MSG)}
/* other fields are set to 0 */
#define _Py_INIT_NO_MEMORY() _Py_INIT_ERR("memory allocation failed")
#define _Py_INIT_EXIT(EXITCODE) \
(_PyInitError){ \
._type = _Py_INIT_ERR_TYPE_EXIT, \
.exitcode = (EXITCODE)}
#define _Py_INIT_IS_ERROR(err) \
(err._type == _Py_INIT_ERR_TYPE_ERROR)
#define _Py_INIT_IS_EXIT(err) \
(err._type == _Py_INIT_ERR_TYPE_EXIT)
#define _Py_INIT_FAILED(err) \
(err._type != _Py_INIT_ERR_TYPE_OK)

/* --- _PyWstrList ------------------------------------------------ */

Expand All @@ -56,8 +35,6 @@ typedef struct {
wchar_t **items;
} _PyWstrList;

#define _PyWstrList_INIT (_PyWstrList){.length = 0, .items = NULL}


/* --- _PyPreConfig ----------------------------------------------- */

Expand Down
32 changes: 32 additions & 0 deletions Include/internal/pycore_coreconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,41 @@ extern "C" {

#include "pycore_pystate.h" /* _PyRuntimeState */


/* --- _PyWstrList ------------------------------------------------ */

#ifndef NDEBUG
PyAPI_FUNC(int) _PyWstrList_CheckConsistency(const _PyWstrList *list);
#endif
Expand Down
1 change: 1 addition & 0 deletions Modules/faulthandler.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Python.h"
#include "pythread.h"
#include <signal.h>
#include <object.h>
Expand Down
1 change: 1 addition & 0 deletions PC/getpathp.c
Original file line number Diff line number Diff line change
@@ -80,6 +80,7 @@


#include "Python.h"
#include "pycore_pystate.h"
#include "osdefs.h"
#include <wchar.h>
Expand Down
2 changes: 1 addition & 1 deletion Programs/_freeze_importlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ main(int argc, char *argv[])
_PyInitError err = _Py_InitializeFromConfig(&config);
/* No need to call _PyCoreConfig_Clear() since we didn't allocate any
memory: program_name is a constant string. */
if (_Py_INIT_FAILED(err)) {
_Py_ExitInitError(err);
}

1 change: 1 addition & 0 deletions Python/bootstrap_hash.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Python.h"
#ifdef MS_WINDOWS
# include <windows.h>
/* All sample MSDN wincrypt programs include the header below. It is at least
Expand Down
Loading
Toggle all file notes Toggle all file annotations