[Python-checkins] bpo-44113: Update fromzenmain not to use Py_SetProgramName (GH-26085)

corona10 webhook-mailer at python.org
Wed May 12 21:19:50 EDT 2021


https://github.com/python/cpython/commit/7565586724692e2ad164d770af9675f7a261fe3a
commit: 7565586724692e2ad164d770af9675f7a261fe3a
branch: main
author: Dong-hee Na <donghee.na at python.org>
committer: corona10 <donghee.na92 at gmail.com>
date: 2021-05-13T10:19:46+09:00
summary:

bpo-44113: Update fromzenmain not to use Py_SetProgramName (GH-26085)

files:
M Python/frozenmain.c

diff --git a/Python/frozenmain.c b/Python/frozenmain.c
index dd04d609d24f9..5eb9e31112484 100644
--- a/Python/frozenmain.c
+++ b/Python/frozenmain.c
@@ -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);



More information about the Python-checkins mailing list