mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
[3.14] gh-139927: Fix test_embed on OpenIndiana (GH-142514) (#142520)
gh-139927: Fix test_embed on OpenIndiana (GH-142514)
Avoid swprintf() function in Programs/_testembed.c since it doesn't
work as expected on OpenIndiana.
(cherry picked from commit c76cfe8d89)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
36d4f67b3c
commit
35df805bb7
1 changed files with 14 additions and 9 deletions
|
|
@ -2116,15 +2116,20 @@ static int check_use_frozen_modules(const char *rawval)
|
|||
if (rawval == NULL) {
|
||||
wcscpy(optval, L"frozen_modules");
|
||||
}
|
||||
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;
|
||||
else {
|
||||
wchar_t *val = Py_DecodeLocale(rawval, NULL);
|
||||
if (val == NULL) {
|
||||
error("unable to decode TESTFROZEN");
|
||||
return -1;
|
||||
}
|
||||
wcscpy(optval, L"frozen_modules=");
|
||||
if ((wcslen(optval) + wcslen(val)) >= Py_ARRAY_LENGTH(optval)) {
|
||||
error("TESTFROZEN is too long");
|
||||
PyMem_RawFree(val);
|
||||
return -1;
|
||||
}
|
||||
wcscat(optval, val);
|
||||
PyMem_RawFree(val);
|
||||
}
|
||||
|
||||
PyConfig config;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue