[Python-checkins] bpo-45666: Use `%S` for MSVC and `%s` elsewhere for `swprintf` in `_testembed.c` (GH-29341)

Fidget-Spinner webhook-mailer at python.org
Mon Nov 1 08:11:44 EDT 2021


https://github.com/python/cpython/commit/401d25e92f62a9ef320a97542b3e63cb8c34e7e9
commit: 401d25e92f62a9ef320a97542b3e63cb8c34e7e9
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: Fidget-Spinner <28750310+Fidget-Spinner at users.noreply.github.com>
date: 2021-11-01T20:11:34+08:00
summary:

bpo-45666: Use `%S` for MSVC and `%s` elsewhere for `swprintf` in `_testembed.c` (GH-29341)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner at users.noreply.github.com>

files:
M Programs/_testembed.c

diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index 1ed3bd00edff6..8077c470c07c5 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -1733,7 +1733,13 @@ static int check_use_frozen_modules(const char *rawval)
     if (rawval == NULL) {
         wcscpy(optval, L"frozen_modules");
     }
-    else if (swprintf(optval, 100, L"frozen_modules=%S", rawval) < 0) {
+    else if (swprintf(optval, 100,
+#if defined(_MSC_VER)
+        L"frozen_modules=%S",
+#else
+        L"frozen_modules=%s",
+#endif
+        rawval) < 0) {
         error("rawval is too long");
         return -1;
     }



More information about the Python-checkins mailing list