[Python-checkins] bpo-36301: Fix _PyPreConfig_Read() compiler warning (GH-12695)

Victor Stinner webhook-mailer at python.org
Fri Apr 5 05:44:10 EDT 2019


https://github.com/python/cpython/commit/6a8c3139ae9ada89d4a95985ec7cf8bb7d03bc01
commit: 6a8c3139ae9ada89d4a95985ec7cf8bb7d03bc01
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-04-05T11:44:04+02:00
summary:

bpo-36301: Fix _PyPreConfig_Read() compiler warning (GH-12695)

Initialize init_utf8_mode earlier to fix a compiler warning.

files:
M Python/preconfig.c

diff --git a/Python/preconfig.c b/Python/preconfig.c
index 7ac645d7f08b..78377cf6e3a2 100644
--- a/Python/preconfig.c
+++ b/Python/preconfig.c
@@ -720,6 +720,11 @@ _PyPreConfig_Read(_PyPreConfig *config, const _PyArgv *args)
     _Py_SetLocaleFromEnv(LC_CTYPE);
 
     _PyPreCmdline cmdline = _PyPreCmdline_INIT;
+    int init_utf8_mode = Py_UTF8Mode;
+#ifdef MS_WINDOWS
+    int init_legacy_encoding = Py_LegacyWindowsFSEncodingFlag;
+#endif
+
     if (args) {
         err = _PyPreCmdline_SetArgv(&cmdline, args);
         if (_Py_INIT_FAILED(err)) {
@@ -727,10 +732,6 @@ _PyPreConfig_Read(_PyPreConfig *config, const _PyArgv *args)
         }
     }
 
-    int init_utf8_mode = Py_UTF8Mode;
-#ifdef MS_WINDOWS
-    int init_legacy_encoding = Py_LegacyWindowsFSEncodingFlag;
-#endif
     int locale_coerced = 0;
     int loops = 0;
 



More information about the Python-checkins mailing list