summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-09-17 18:01:39 -0700
committerGitHub <noreply@github.com>2018-09-17 18:01:39 -0700
commit144f1e2c6f4a24bd288c045986842c65cc289684 (patch)
tree26220394766aa9b5cdfbd9579e5e0ebb5b1f70d4 /Include
parent512d7101098b971837cbb406942215244f636547 (diff)
downloadcpython-git-144f1e2c6f4a24bd288c045986842c65cc289684.tar.gz
[3.7] bpo-34589: Add -X coerce_c_locale option; C locale coercion off by default (GH-9379)
* bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371) _PyCoreConfig: * Rename coerce_c_locale to _coerce_c_locale * Rename coerce_c_locale_warn to _coerce_c_locale_warn These fields are now private (name prefixed by "_"). (cherry picked from commit 188ebfa475a6f6aa2d0ea14ca8e1fbe7865b6d27) * 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. (cherry picked from commit 7a0791b6992d420dc52536257f2f093851ed7215) * bpo-34589: Add -X coerce_c_locale command line option (GH-9378) Add a new -X coerce_c_locale command line option to control C locale coercion (PEP 538). (cherry picked from commit dbdee0073cf0b88fe541980ace1f650900f455cc)
Diffstat (limited to 'Include')
-rw-r--r--Include/pylifecycle.h4
-rw-r--r--Include/pystate.h7
2 files changed, 8 insertions, 3 deletions
diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h
index 1192961949..68fc036479 100644
--- a/Include/pylifecycle.h
+++ b/Include/pylifecycle.h
@@ -119,7 +119,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 */
diff --git a/Include/pystate.h b/Include/pystate.h
index f16ffb8fd2..c2ccb203db 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -41,8 +41,6 @@ typedef struct {
int show_alloc_count; /* -X showalloccount */
int dump_refs; /* PYTHONDUMPREFS */
int malloc_stats; /* PYTHONMALLOCSTATS */
- int coerce_c_locale; /* PYTHONCOERCECLOCALE, -1 means unknown */
- int coerce_c_locale_warn; /* PYTHONCOERCECLOCALE=warn */
int utf8_mode; /* PYTHONUTF8, -X utf8; -1 means unknown */
wchar_t *program_name; /* Program name, see also Py_GetProgramName() */
@@ -74,6 +72,8 @@ typedef struct {
/* Private fields */
int _disable_importlib; /* Needed by freeze_importlib */
+ int _coerce_c_locale; /* PYTHONCOERCECLOCALE, -1 means unknown */
+ int _coerce_c_locale_warn; /* PYTHONCOERCECLOCALE=warn */
} _PyCoreConfig;
#define _PyCoreConfig_INIT \
@@ -81,7 +81,8 @@ typedef struct {
.install_signal_handlers = -1, \
.ignore_environment = -1, \
.use_hash_seed = -1, \
- .coerce_c_locale = -1, \
+ ._coerce_c_locale = 0, \
+ ._coerce_c_locale_warn = 0, \
.faulthandler = -1, \
.tracemalloc = -1, \
.utf8_mode = -1, \