Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,13 +888,13 @@ pymain_main(_PyArgv *args)
PyInterpreterState *interp;
err = pymain_init(args, &interp);
if (_Py_INIT_FAILED(err)) {
_Py_ExitInitError(err);
goto exit_init_error;
}

int exitcode = 0;
err = pymain_run_python(interp, &exitcode);
if (_Py_INIT_FAILED(err)) {
_Py_ExitInitError(err);
goto exit_init_error;
}

if (Py_FinalizeEx() < 0) {
Expand All @@ -910,6 +910,10 @@ pymain_main(_PyArgv *args)
}

return exitcode;

exit_init_error:
pymain_free();
_Py_ExitInitError(err);
}


Expand Down
5 changes: 5 additions & 0 deletions Python/pathconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ _PyPathConfig_SetGlobal(const _PyPathConfig *config)
void
_PyPathConfig_ClearGlobal(void)
{
PyMemAllocatorEx old_alloc;
_PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);

_PyPathConfig_Clear(&_Py_path_config);

PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
}


Expand Down
1 change: 1 addition & 0 deletions Python/preconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ _PyPreConfig_ReadFromArgv(_PyPreConfig *config, const _PyArgv *args)
done:
if (init_ctype_locale != NULL) {
setlocale(LC_CTYPE, init_ctype_locale);
PyMem_RawFree(init_ctype_locale);
}
_PyPreConfig_Clear(&save_config);
Py_UTF8Mode = init_utf8_mode ;
Expand Down