summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 0aa5e4a..0fe7b56 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -40,7 +40,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#include "pycore_coreconfig.h"
+#include "pycore_initconfig.h"
#include "pycore_fileutils.h"
#include "pycore_object.h"
#include "pycore_pylifecycle.h"
@@ -3549,9 +3549,9 @@ PyUnicode_EncodeFSDefault(PyObject *unicode)
interp->fs_codec.errors);
}
else {
- const _PyCoreConfig *config = &interp->core_config;
+ const wchar_t *filesystem_errors = interp->config.filesystem_errors;
_Py_error_handler errors;
- errors = get_error_handler_wide(config->filesystem_errors);
+ errors = get_error_handler_wide(filesystem_errors);
assert(errors != _Py_ERROR_UNKNOWN);
return unicode_encode_utf8(unicode, errors, NULL);
}
@@ -3567,9 +3567,9 @@ PyUnicode_EncodeFSDefault(PyObject *unicode)
interp->fs_codec.errors);
}
else {
- const _PyCoreConfig *config = &interp->core_config;
+ const wchar_t *filesystem_errors = interp->config.filesystem_errors;
_Py_error_handler errors;
- errors = get_error_handler_wide(config->filesystem_errors);
+ errors = get_error_handler_wide(filesystem_errors);
assert(errors != _Py_ERROR_UNKNOWN);
return unicode_encode_locale(unicode, errors, 0);
}
@@ -3787,9 +3787,9 @@ PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size)
NULL);
}
else {
- const _PyCoreConfig *config = &interp->core_config;
+ const wchar_t *filesystem_errors = interp->config.filesystem_errors;
_Py_error_handler errors;
- errors = get_error_handler_wide(config->filesystem_errors);
+ errors = get_error_handler_wide(filesystem_errors);
assert(errors != _Py_ERROR_UNKNOWN);
return unicode_decode_utf8(s, size, errors, NULL, NULL);
}
@@ -3805,9 +3805,9 @@ PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size)
interp->fs_codec.errors);
}
else {
- const _PyCoreConfig *config = &interp->core_config;
+ const wchar_t *filesystem_errors = interp->config.filesystem_errors;
_Py_error_handler errors;
- errors = get_error_handler_wide(config->filesystem_errors);
+ errors = get_error_handler_wide(filesystem_errors);
return unicode_decode_locale(s, size, errors, 0);
}
#endif
@@ -15200,7 +15200,7 @@ PyTypeObject PyUnicode_Type = {
/* Initialize the Unicode implementation */
-_PyInitError
+PyStatus
_PyUnicode_Init(void)
{
/* XXX - move this array to unicodectype.c ? */
@@ -15218,12 +15218,12 @@ _PyUnicode_Init(void)
/* Init the implementation */
_Py_INCREF_UNICODE_EMPTY();
if (!unicode_empty) {
- return _Py_INIT_ERR("Can't create empty string");
+ return _PyStatus_ERR("Can't create empty string");
}
Py_DECREF(unicode_empty);
if (PyType_Ready(&PyUnicode_Type) < 0) {
- return _Py_INIT_ERR("Can't initialize unicode type");
+ return _PyStatus_ERR("Can't initialize unicode type");
}
/* initialize the linebreak bloom filter */
@@ -15232,15 +15232,15 @@ _PyUnicode_Init(void)
Py_ARRAY_LENGTH(linebreak));
if (PyType_Ready(&EncodingMapType) < 0) {
- return _Py_INIT_ERR("Can't initialize encoding map type");
+ return _PyStatus_ERR("Can't initialize encoding map type");
}
if (PyType_Ready(&PyFieldNameIter_Type) < 0) {
- return _Py_INIT_ERR("Can't initialize field name iterator type");
+ return _PyStatus_ERR("Can't initialize field name iterator type");
}
if (PyType_Ready(&PyFormatterIter_Type) < 0) {
- return _Py_INIT_ERR("Can't initialize formatter iter type");
+ return _PyStatus_ERR("Can't initialize formatter iter type");
}
- return _Py_INIT_OK();
+ return _PyStatus_OK();
}
/* Finalize the Unicode implementation */
@@ -15718,23 +15718,23 @@ error:
}
-static _PyInitError
+static PyStatus
init_stdio_encoding(PyInterpreterState *interp)
{
/* Update the stdio encoding to the normalized Python codec name. */
- _PyCoreConfig *config = &interp->core_config;
+ PyConfig *config = &interp->config;
if (config_get_codec_name(&config->stdio_encoding) < 0) {
- return _Py_INIT_ERR("failed to get the Python codec name "
+ return _PyStatus_ERR("failed to get the Python codec name "
"of the stdio encoding");
}
- return _Py_INIT_OK();
+ return _PyStatus_OK();
}
static int
init_fs_codec(PyInterpreterState *interp)
{
- _PyCoreConfig *config = &interp->core_config;
+ PyConfig *config = &interp->config;
_Py_error_handler error_handler;
error_handler = get_error_handler_wide(config->filesystem_errors);
@@ -15778,31 +15778,31 @@ init_fs_codec(PyInterpreterState *interp)
}
-static _PyInitError
+static PyStatus
init_fs_encoding(PyInterpreterState *interp)
{
/* Update the filesystem encoding to the normalized Python codec name.
For example, replace "ANSI_X3.4-1968" (locale encoding) with "ascii"
(Python codec name). */
- _PyCoreConfig *config = &interp->core_config;
+ PyConfig *config = &interp->config;
if (config_get_codec_name(&config->filesystem_encoding) < 0) {
- return _Py_INIT_ERR("failed to get the Python codec "
+ return _PyStatus_ERR("failed to get the Python codec "
"of the filesystem encoding");
}
if (init_fs_codec(interp) < 0) {
- return _Py_INIT_ERR("cannot initialize filesystem codec");
+ return _PyStatus_ERR("cannot initialize filesystem codec");
}
- return _Py_INIT_OK();
+ return _PyStatus_OK();
}
-_PyInitError
+PyStatus
_PyUnicode_InitEncodings(PyInterpreterState *interp)
{
- _PyInitError err = init_fs_encoding(interp);
- if (_Py_INIT_FAILED(err)) {
- return err;
+ PyStatus status = init_fs_encoding(interp);
+ if (_PyStatus_EXCEPTION(status)) {
+ return status;
}
return init_stdio_encoding(interp);
@@ -15814,7 +15814,7 @@ int
_PyUnicode_EnableLegacyWindowsFSEncoding(void)
{
PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
- _PyCoreConfig *config = &interp->core_config;
+ PyConfig *config = &interp->config;
/* Set the filesystem encoding to mbcs/replace (PEP 529) */
wchar_t *encoding = _PyMem_RawWcsdup(L"mbcs");