bpo-40521: Add PyInterpreterState.unicode (GH-20081)

Move PyInterpreterState.fs_codec into a new
PyInterpreterState.unicode structure.

Give a name to the fs_codec structure and use this structure in
unicodeobject.c.
This commit is contained in:
Victor Stinner 2020-05-14 01:48:38 +02:00 • committed by GitHub
parent 75cd8e48c6
commit 3d17c045b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 40 deletions

View file

@ -51,6 +51,19 @@ struct _ceval_state {
#endif
};
/* fs_codec.encoding is initialized to NULL.
Later, it is set to a non-NULL string by _PyUnicode_InitEncodings(). */
struct _Py_unicode_fs_codec {
char *encoding; // Filesystem encoding (encoded to UTF-8)
int utf8; // encoding=="utf-8"?
char *errors; // Filesystem errors (encoded to UTF-8)
_Py_error_handler error_handler;
};
struct _Py_unicode_state {
struct _Py_unicode_fs_codec fs_codec;
};
/* interpreter state */
@ -97,14 +110,7 @@ struct _is {
PyObject *codec_error_registry;
int codecs_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) */
int utf8; /* encoding=="utf-8"? */
char *errors; /* Filesystem errors (encoded to UTF-8) */
_Py_error_handler error_handler;
} fs_codec;
struct _Py_unicode_state unicode;
PyConfig config;
#ifdef HAVE_DLOPEN