@@ -130,7 +130,7 @@ typedef struct {
130130 wchar_t * exec_prefix_macro ; /* EXEC_PREFIX macro */
131131 wchar_t * vpath_macro ; /* VPATH macro */
132132
133- wchar_t * lib_python ; /* "lib/ pythonX.Y" */
133+ wchar_t * lib_python ; /* <platlibdir> / " pythonX.Y" */
134134
135135 int prefix_found ; /* found platform independent libraries? */
136136 int exec_prefix_found ; /* found the platform dependent libraries? */
@@ -810,7 +810,7 @@ calculate_exec_prefix(PyCalculatePath *calculate, _PyPathConfig *pathconfig)
810810 "Could not find platform dependent libraries <exec_prefix>\n" );
811811 }
812812
813- /* <PLATLIBDIR > / "lib-dynload" */
813+ /* <platlibdir > / "lib-dynload" */
814814 wchar_t * lib_dynload = joinpath2 (calculate -> platlibdir ,
815815 L"lib-dynload" );
816816 if (lib_dynload == NULL ) {
@@ -1296,16 +1296,18 @@ calculate_zip_path(PyCalculatePath *calculate)
12961296{
12971297 PyStatus res ;
12981298
1299- /* Path: <PLATLIBDIR> / "pythonXY.zip" */
1300- wchar_t * path = joinpath2 (calculate -> platlibdir , L"python" Py_STRINGIFY (PY_MAJOR_VERSION ) Py_STRINGIFY (PY_MINOR_VERSION ) L".zip" );
1299+ /* Path: <platlibdir> / "pythonXY.zip" */
1300+ wchar_t * path = joinpath2 (calculate -> platlibdir ,
1301+ L"python" Py_STRINGIFY (PY_MAJOR_VERSION ) Py_STRINGIFY (PY_MINOR_VERSION )
1302+ L".zip" );
13011303 if (path == NULL ) {
13021304 return _PyStatus_NO_MEMORY ();
13031305 }
13041306
13051307 if (calculate -> prefix_found > 0 ) {
13061308 /* Use the reduced prefix returned by Py_GetPrefix()
13071309
1308- Path: <basename(basename(prefix))> / <PLATLIBDIR > / "python00 .zip" */
1310+ Path: <basename(basename(prefix))> / <platlibdir > / "pythonXY .zip" */
13091311 wchar_t * parent = _PyMem_RawWcsdup (calculate -> prefix );
13101312 if (parent == NULL ) {
13111313 res = _PyStatus_NO_MEMORY ();
@@ -1431,6 +1433,11 @@ static PyStatus
14311433calculate_init (PyCalculatePath * calculate , const PyConfig * config )
14321434{
14331435 size_t len ;
1436+
1437+ calculate -> warnings = config -> pathconfig_warnings ;
1438+ calculate -> pythonpath_env = config -> pythonpath_env ;
1439+ calculate -> platlibdir = config -> platlibdir ;
1440+
14341441 const char * path = getenv ("PATH" );
14351442 if (path ) {
14361443 calculate -> path_env = Py_DecodeLocale (path , & len );
@@ -1457,14 +1464,16 @@ calculate_init(PyCalculatePath *calculate, const PyConfig *config)
14571464 return DECODE_LOCALE_ERR ("VPATH macro" , len );
14581465 }
14591466
1460- calculate -> lib_python = Py_DecodeLocale (PLATLIBDIR "/python" VERSION , & len );
1461- if (!calculate -> lib_python ) {
1467+ // <platlibdir> / "pythonX.Y"
1468+ wchar_t * pyversion = Py_DecodeLocale ("python" VERSION , & len );
1469+ if (!pyversion ) {
14621470 return DECODE_LOCALE_ERR ("VERSION macro" , len );
14631471 }
1464-
1465- calculate -> warnings = config -> pathconfig_warnings ;
1466- calculate -> pythonpath_env = config -> pythonpath_env ;
1467- calculate -> platlibdir = config -> platlibdir ;
1472+ calculate -> lib_python = joinpath2 (config -> platlibdir , pyversion );
1473+ PyMem_RawFree (pyversion );
1474+ if (calculate -> lib_python == NULL ) {
1475+ return _PyStatus_NO_MEMORY ();
1476+ }
14681477
14691478 return _PyStatus_OK ();
14701479}
0 commit comments