]> granicus.if.org Git - python/commitdiff
bpo-36301: Fix _PyPreConfig_Read() compiler warning (GH-12695)
authorVictor Stinner <vstinner@redhat.com>
Fri, 5 Apr 2019 09:44:04 +0000 (11:44 +0200)
committerGitHub <noreply@github.com>
Fri, 5 Apr 2019 09:44:04 +0000 (11:44 +0200)
Initialize init_utf8_mode earlier to fix a compiler warning.

Python/preconfig.c

index 7ac645d7f08b2012de46dddb487748e126da36dc..78377cf6e3a26a724bd8f326a1344e0f5c99e543 100644 (file)
@@ -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;