]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44113: Update fromzenmain not to use Py_SetProgramName (GH-26085)
authorDong-hee Na <donghee.na@python.org>
Thu, 13 May 2021 01:19:46 +0000 (10:19 +0900)
committerGitHub <noreply@github.com>
Thu, 13 May 2021 01:19:46 +0000 (10:19 +0900)
Python/frozenmain.c

index dd04d609d24f9315f910d96f327c0210c70ab634..5eb9e31112484a0b87f90f7199253d7735789b9c 100644 (file)
@@ -78,8 +78,14 @@ Py_FrozenMain(int argc, char **argv)
 #ifdef MS_WINDOWS
     PyInitFrozenExtensions();
 #endif /* MS_WINDOWS */
-    if (argc >= 1)
-        Py_SetProgramName(argv_copy[0]);
+    if (argc >= 1) {
+        status = PyConfig_SetString(&config, &config.program_name,
+                                    argv_copy[0]);
+        if (PyStatus_Exception(status)) {
+            PyConfig_Clear(&config);
+            Py_ExitStatusException(status);
+        }
+    }
 
     status = Py_InitializeFromConfig(&config);
     PyConfig_Clear(&config);