summaryrefslogtreecommitdiff
path: root/Python/coreconfig.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-01 05:35:33 +0200
committerGitHub <noreply@github.com>2019-05-01 05:35:33 +0200
commitdb7197543112954b0912e3d46e39fefcb1c3b950 (patch)
tree0c82232775c6b1a03671054f9e70f2bb99e6adc9 /Python/coreconfig.c
parentc4e671eec20dfcb29b18596a89ef075f826c9f96 (diff)
downloadcpython-git-db7197543112954b0912e3d46e39fefcb1c3b950.tar.gz
bpo-36763: Rework _PyInitError API (GH-13031)
* Remove _PyInitError.user_err field and _Py_INIT_USER_ERR() macro: use _Py_INIT_ERR() instead. _Py_ExitInitError() now longer calls abort() on error: exit with exit code 1 instead. * Add _PyInitError._type private field. * exitcode field type is now unsigned int on Windows. * Rename prefix field to _func. * Rename msg field to err_msg.
Diffstat (limited to 'Python/coreconfig.c')
-rw-r--r--Python/coreconfig.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/Python/coreconfig.c b/Python/coreconfig.c
index 750676a473..4bfe745ce4 100644
--- a/Python/coreconfig.c
+++ b/Python/coreconfig.c
@@ -475,7 +475,7 @@ Py_GetArgcArgv(int *argc, wchar_t ***argv)
#define DECODE_LOCALE_ERR(NAME, LEN) \
(((LEN) == -2) \
- ? _Py_INIT_USER_ERR("cannot decode " NAME) \
+ ? _Py_INIT_ERR("cannot decode " NAME) \
: _Py_INIT_NO_MEMORY())
/* Free memory allocated in config, but don't clear all attributes */
@@ -1018,8 +1018,8 @@ config_init_hash_seed(_PyCoreConfig *config)
|| seed > 4294967295UL
|| (errno == ERANGE && seed == ULONG_MAX))
{
- return _Py_INIT_USER_ERR("PYTHONHASHSEED must be \"random\" "
- "or an integer in range [0; 4294967295]");
+ return _Py_INIT_ERR("PYTHONHASHSEED must be \"random\" "
+ "or an integer in range [0; 4294967295]");
}
/* Use a specific hash */
config->use_hash_seed = 1;
@@ -1129,8 +1129,7 @@ config_init_tracemalloc(_PyCoreConfig *config)
valid = 0;
}
if (!valid) {
- return _Py_INIT_USER_ERR("PYTHONTRACEMALLOC: invalid number "
- "of frames");
+ return _Py_INIT_ERR("PYTHONTRACEMALLOC: invalid number of frames");
}
config->tracemalloc = nframe;
}
@@ -1146,8 +1145,8 @@ config_init_tracemalloc(_PyCoreConfig *config)
valid = 0;
}
if (!valid) {
- return _Py_INIT_USER_ERR("-X tracemalloc=NFRAME: "
- "invalid number of frames");
+ return _Py_INIT_ERR("-X tracemalloc=NFRAME: "
+ "invalid number of frames");
}
}
else {
@@ -1267,8 +1266,8 @@ config_get_locale_encoding(char **locale_encoding)
#else
const char *encoding = nl_langinfo(CODESET);
if (!encoding || encoding[0] == '\0') {
- return _Py_INIT_USER_ERR("failed to get the locale encoding: "
- "nl_langinfo(CODESET) failed");
+ return _Py_INIT_ERR("failed to get the locale encoding: "
+ "nl_langinfo(CODESET) failed");
}
#endif
*locale_encoding = _PyMem_RawStrdup(encoding);