@@ -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 > / "pythonXY.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 ();
@@ -1426,6 +1428,11 @@ static PyStatus
14261428calculate_init (PyCalculatePath * calculate , const PyConfig * config )
14271429{
14281430 size_t len ;
1431+
1432+ calculate -> warnings = config -> pathconfig_warnings ;
1433+ calculate -> pythonpath_env = config -> pythonpath_env ;
1434+ calculate -> platlibdir = config -> platlibdir ;
1435+
14291436 const char * path = getenv ("PATH" );
14301437 if (path ) {
14311438 calculate -> path_env = Py_DecodeLocale (path , & len );
@@ -1452,14 +1459,16 @@ calculate_init(PyCalculatePath *calculate, const PyConfig *config)
14521459 return DECODE_LOCALE_ERR ("VPATH macro" , len );
14531460 }
14541461
1455- calculate -> lib_python = Py_DecodeLocale (PLATLIBDIR "/python" VERSION , & len );
1456- if (!calculate -> lib_python ) {
1462+ // <platlibdir> / "pythonX.Y"
1463+ wchar_t * pyversion = Py_DecodeLocale ("python" VERSION , & len );
1464+ if (!pyversion ) {
14571465 return DECODE_LOCALE_ERR ("VERSION macro" , len );
14581466 }
1459-
1460- calculate -> warnings = config -> pathconfig_warnings ;
1461- calculate -> pythonpath_env = config -> pythonpath_env ;
1462- calculate -> platlibdir = config -> platlibdir ;
1467+ calculate -> lib_python = joinpath2 (config -> platlibdir , pyversion );
1468+ PyMem_RawFree (pyversion );
1469+ if (calculate -> lib_python == NULL ) {
1470+ return _PyStatus_NO_MEMORY ();
1471+ }
14631472
14641473 return _PyStatus_OK ();
14651474}
0 commit comments