Skip to content

Commit

Permalink
bootloader: always call Py_GetPath before Py_SetPath
Browse files Browse the repository at this point in the history
  • Loading branch information
rokm committed Jul 27, 2023
1 parent a921ee3 commit 915a053
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions bootloader/src/pyi_pythonlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,14 @@ pyi_pylib_start_python(ARCHIVE_STATUS *status)
return -1;
}
VS("LOADER: Pre-init sys.path is %s\n", pypath);
#ifdef _WIN32
// Call GetPath first, so the static dllpath will be set as a side
// effect. Workaround for http://bugs.python.org/issue29778, see #2496.
// Due to another bug calling this on non-win32 with Python 3.6 causes
// memory corruption, see #2812 and
// https://bugs.python.org/issue31532. But the workaround is only
// needed for win32.

/*
* Call Py_GetPath() first. This used be necessary on Windows to
* work around https://bugs.python.org/issue29778, but it also seems
* necessary with Python 3.8 and 3.9 when python's memory debugging
* and validation is enabled (PYTHONMALLOC=debug, PYTHONDEVMODE=1).
*/
PI_Py_GetPath();
#endif
PI_Py_SetPath(pypath_w);

/* Start python. */
Expand Down

0 comments on commit 915a053

Please sign in to comment.