mirror of
https://github.com/python/cpython.git
synced 2025-07-20 01:35:19 +00:00
Issue #15893: Improve error handling in main() and Py_FrozenMain()
* handle _PyMem_RawStrdup() failure * Py_FrozenMain() releases memory on error * Py_FrozenMain() duplicates the old locale, as done in main()
This commit is contained in:
parent
739cf4e3e6
commit
c588feeea9
2 changed files with 28 additions and 16 deletions
|
@ -45,6 +45,11 @@ main(int argc, char **argv)
|
|||
#endif
|
||||
|
||||
oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
|
||||
if (!oldloc) {
|
||||
fprintf(stderr, "out of memory\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
for (i = 0; i < argc; i++) {
|
||||
argv_copy[i] = _Py_char2wchar(argv[i], NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue