summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-09-17 23:22:29 (GMT)
committerGitHub <noreply@github.com>2018-09-17 23:22:29 (GMT)
commit7a0791b6992d420dc52536257f2f093851ed7215 (patch)
treed41edd6bc79c92232213480fc853dd86530780bf /Include
parent1fa2ec49bec50bea1847b558b883c5c904334734 (diff)
downloadcpython-7a0791b6992d420dc52536257f2f093851ed7215.zip
cpython-7a0791b6992d420dc52536257f2f093851ed7215.tar.gz
cpython-7a0791b6992d420dc52536257f2f093851ed7215.tar.bz2
bpo-34589: C locale coercion off by default (GH-9073)
Py_Initialize() and Py_Main() cannot enable the C locale coercion (PEP 538) anymore: it is always disabled. It can now only be enabled by the Python program ("python3). test_embed: get_filesystem_encoding() doesn't have to set PYTHONUTF8 nor PYTHONCOERCECLOCALE, these variables are already set in the parent.
Diffstat (limited to 'Include')
-rw-r--r--Include/coreconfig.h11
-rw-r--r--Include/pylifecycle.h4
2 files changed, 14 insertions, 1 deletions
diff --git a/Include/coreconfig.h b/Include/coreconfig.h
index 8944ec2..293d8ed 100644
--- a/Include/coreconfig.h
+++ b/Include/coreconfig.h
@@ -301,6 +301,10 @@ typedef struct {
variable. The option is also enabled if the LC_CTYPE locale is "C"
and a target locale (ex: "C.UTF-8") is supported by the platform.
+ Py_Initialize() and Py_Main() must not enable C locale coercion: it is
+ always disabled. The option can only be enabled by the Python program
+ ("python3).
+
See also the _coerce_c_locale_warn option. */
int _coerce_c_locale;
@@ -308,6 +312,10 @@ typedef struct {
Enabled by the PYTHONCOERCECLOCALE=warn environment variable.
+ Py_Initialize() and Py_Main() must not enable C locale coercion warning:
+ it is always disabled. The warning can only be enabled by the Python
+ program ("python3).
+
See also the _coerce_c_locale option. */
int _coerce_c_locale_warn;
@@ -328,7 +336,8 @@ typedef struct {
.use_hash_seed = -1, \
.faulthandler = -1, \
.tracemalloc = -1, \
- ._coerce_c_locale = -1, \
+ ._coerce_c_locale = 0, \
+ ._coerce_c_locale_warn = 0, \
.utf8_mode = -1, \
.argc = -1, \
.nmodule_search_path = -1, \
diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h
index 04e672e..f64bae3 100644
--- a/Include/pylifecycle.h
+++ b/Include/pylifecycle.h
@@ -83,7 +83,11 @@ PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
/* Bootstrap __main__ (defined in Modules/main.c) */
PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
#ifdef Py_BUILD_CORE
+# ifdef MS_WINDOWS
+PyAPI_FUNC(int) _Py_WindowsMain(int argc, wchar_t **argv);
+# else
PyAPI_FUNC(int) _Py_UnixMain(int argc, char **argv);
+# endif
#endif
/* In getpath.c */