summaryrefslogtreecommitdiff
path: root/Python/preconfig.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-11-02 16:49:54 +0100
committerGitHub <noreply@github.com>2020-11-02 16:49:54 +0100
commit4b9aad49992a825d8c76e428ed1aca81dd3878b2 (patch)
tree3834f555ab9a469313ba1783b1e2e5ca7af94e51 /Python/preconfig.c
parent301822859b3fc34801a06f1090d62f9f2ee5b092 (diff)
downloadcpython-git-4b9aad49992a825d8c76e428ed1aca81dd3878b2.tar.gz
bpo-42236: Enhance init and encoding documentation (GH-23109)
Enhance the documentation of the Python startup, filesystem encoding and error handling, locale encoding. Add a new "Python UTF-8 Mode" section. * Add "locale encoding" and "filesystem encoding and error handler" to the glossary * Remove documentation from Include/cpython/initconfig.h: move it to Doc/c-api/init_config.rst. * Doc/c-api/init_config.rst: * Document command line options and environment variables * Document default values. * Add a new "Python UTF-8 Mode" section in Doc/library/os.rst. * Add warnings to Py_DecodeLocale() and Py_EncodeLocale() docs. * Document how Python selects the filesystem encoding and error handler at a single place: PyConfig.filesystem_encoding and PyConfig.filesystem_errors. * PyConfig: move orig_argv member at the right place.
Diffstat (limited to 'Python/preconfig.c')
-rw-r--r--Python/preconfig.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Python/preconfig.c b/Python/preconfig.c
index 149afcd99a..b8b0c3a077 100644
--- a/Python/preconfig.c
+++ b/Python/preconfig.c
@@ -19,11 +19,6 @@ preconfig_copy(PyPreConfig *config, const PyPreConfig *config2);
/* --- File system encoding/errors -------------------------------- */
-/* The filesystem encoding is chosen by config_init_fs_encoding(),
- see also initfsencoding().
-
- Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors
- are encoded to UTF-8. */
const char *Py_FileSystemDefaultEncoding = NULL;
int Py_HasFileSystemDefaultEncoding = 0;
const char *Py_FileSystemDefaultEncodeErrors = NULL;
@@ -44,7 +39,10 @@ _Py_ClearFileSystemEncoding(void)
/* Set Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors
- global configuration variables. */
+ global configuration variables to PyConfig.filesystem_encoding and
+ PyConfig.filesystem_errors (encoded to UTF-8).
+
+ Function called by _PyUnicode_InitEncodings(). */
int
_Py_SetFileSystemEncoding(const char *encoding, const char *errors)
{