mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Back-out wcstok deprecation suppression and updates calls to use wcstok_s.
This commit is contained in:
parent
b3f51e3c44
commit
f63dab5a84
3 changed files with 8 additions and 7 deletions
|
|
@ -520,16 +520,16 @@ Py_Main(int argc, wchar_t **argv)
|
|||
#ifdef MS_WINDOWS
|
||||
if (!Py_IgnoreEnvironmentFlag && (wp = _wgetenv(L"PYTHONWARNINGS")) &&
|
||||
*wp != L'\0') {
|
||||
wchar_t *buf, *warning;
|
||||
wchar_t *buf, *warning, *context = NULL;
|
||||
|
||||
buf = (wchar_t *)PyMem_RawMalloc((wcslen(wp) + 1) * sizeof(wchar_t));
|
||||
if (buf == NULL)
|
||||
Py_FatalError(
|
||||
"not enough memory to copy PYTHONWARNINGS");
|
||||
wcscpy(buf, wp);
|
||||
for (warning = wcstok(buf, L",");
|
||||
for (warning = wcstok_s(buf, L",", &context);
|
||||
warning != NULL;
|
||||
warning = wcstok(NULL, L",")) {
|
||||
warning = wcstok_s(NULL, L",", &context)) {
|
||||
PySys_AddWarnOption(warning);
|
||||
}
|
||||
PyMem_RawFree(buf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue