diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-05-02 18:56:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-02 18:56:30 (GMT) |
commit | 709d23dee69e700b87d5a4cb59e149d0e1af7993 (patch) | |
tree | b06aafe79f83137a3c85649bcebf1fbfd2ea1240 /Include/internal | |
parent | 6ae2bbbdfcb8969d1d362b17c2fbd5a684fa4f9d (diff) | |
download | cpython-709d23dee69e700b87d5a4cb59e149d0e1af7993.zip cpython-709d23dee69e700b87d5a4cb59e149d0e1af7993.tar.gz cpython-709d23dee69e700b87d5a4cb59e149d0e1af7993.tar.bz2 |
bpo-36775: _PyCoreConfig only uses wchar_t* (GH-13062)
_PyCoreConfig: Change filesystem_encoding, filesystem_errors,
stdio_encoding and stdio_errors fields type from char* to wchar_t*.
Changes:
* PyInterpreterState: replace fscodec_initialized (int) with fs_codec
structure.
* Add get_error_handler_wide() and unicode_encode_utf8() helper
functions.
* Add error_handler parameter to unicode_encode_locale()
and unicode_decode_locale().
* Remove _PyCoreConfig_SetString().
* Rename _PyCoreConfig_SetWideString() to _PyCoreConfig_SetString().
* Rename _PyCoreConfig_SetWideStringFromString()
to _PyCoreConfig_DecodeLocale().
Diffstat (limited to 'Include/internal')
-rw-r--r-- | Include/internal/pycore_coreconfig.h | 5 | ||||
-rw-r--r-- | Include/internal/pycore_pylifecycle.h | 3 | ||||
-rw-r--r-- | Include/internal/pycore_pystate.h | 9 |
3 files changed, 12 insertions, 5 deletions
diff --git a/Include/internal/pycore_coreconfig.h b/Include/internal/pycore_coreconfig.h index 8af310d..d48904e 100644 --- a/Include/internal/pycore_coreconfig.h +++ b/Include/internal/pycore_coreconfig.h @@ -106,12 +106,9 @@ PyAPI_FUNC(_PyInitError) _PyCoreConfig_Copy( _PyCoreConfig *config, const _PyCoreConfig *config2); PyAPI_FUNC(_PyInitError) _PyCoreConfig_SetString( - char **config_str, - const char *str); -PyAPI_FUNC(_PyInitError) _PyCoreConfig_SetWideString( wchar_t **config_str, const wchar_t *str); -PyAPI_FUNC(_PyInitError) _PyCoreConfig_SetWideStringFromString( +PyAPI_FUNC(_PyInitError) _PyCoreConfig_DecodeLocale( wchar_t **config_str, const char *str); PyAPI_FUNC(_PyInitError) _PyCoreConfig_InitPathConfig(_PyCoreConfig *config); diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h index a2383d4..321cc5d 100644 --- a/Include/internal/pycore_pylifecycle.h +++ b/Include/internal/pycore_pylifecycle.h @@ -21,6 +21,9 @@ extern int _Py_SetFileSystemEncoding( const char *errors); extern void _Py_ClearFileSystemEncoding(void); extern _PyInitError _PyUnicode_InitEncodings(PyInterpreterState *interp); +#ifdef MS_WINDOWS +extern int _PyUnicode_EnableLegacyWindowsFSEncoding(void); +#endif PyAPI_FUNC(void) _Py_ClearStandardStreamEncoding(void); diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h index 2c24f67..67bcd14 100644 --- a/Include/internal/pycore_pystate.h +++ b/Include/internal/pycore_pystate.h @@ -56,7 +56,14 @@ struct _is { PyObject *codec_search_cache; PyObject *codec_error_registry; int codecs_initialized; - int fscodec_initialized; + + /* fs_codec.encoding is initialized to NULL. + Later, it is set to a non-NULL string by _PyUnicode_InitEncodings(). */ + struct { + char *encoding; /* Filesystem encoding (encoded to UTF-8) */ + char *errors; /* Filesystem errors (encoded to UTF-8) */ + _Py_error_handler error_handler; + } fs_codec; _PyCoreConfig core_config; #ifdef HAVE_DLOPEN |