diff options
-rw-r--r-- | PC/WinMain.c | 1 | ||||
-rw-r--r-- | PC/getpathp.c | 25 | ||||
-rw-r--r-- | PC/python_nt.rc | 6 |
3 files changed, 20 insertions, 12 deletions
diff --git a/PC/WinMain.c b/PC/WinMain.c index d833aa7..e50fb32 100644 --- a/PC/WinMain.c +++ b/PC/WinMain.c @@ -1,6 +1,7 @@ /* Minimal main program -- everything is loaded from the library */ #include <windows.h> +#include "Python.h" extern int Py_Main(); diff --git a/PC/getpathp.c b/PC/getpathp.c index f0714b5..5ff4101 100644 --- a/PC/getpathp.c +++ b/PC/getpathp.c @@ -352,6 +352,7 @@ calculate_path() /* We need to construct a path from the following parts: (1) the PYTHONPATH environment variable, if set; (2) for Win32, the machinepath and userpath, if set; + The following only if neither machinepath nor userpath is set: (3) the PYTHONPATH config macro, with the leading "." of each component replaced with pythonhome, if set; (4) the directory containing the executable (argv0_path). @@ -371,15 +372,17 @@ calculate_path() else bufsz = 0; bufsz += strlen(PYTHONPATH) + 1; - if (envpath != NULL) - bufsz += strlen(envpath) + 1; bufsz += strlen(argv0_path) + 1; #ifdef MS_WIN32 - if (machinepath) - bufsz += strlen(machinepath) + 1; + if (userpath || machinepath) + bufsz = 0; /* Reset! */ if (userpath) bufsz += strlen(userpath) + 1; + if (machinepath) + bufsz += strlen(machinepath) + 1; #endif + if (envpath != NULL) + bufsz += strlen(envpath) + 1; module_search_path = buf = malloc(bufsz); if (buf == NULL) { @@ -408,17 +411,21 @@ calculate_path() *buf++ = DELIM; } #ifdef MS_WIN32 + if (userpath) { + strcpy(buf, userpath); + buf = strchr(buf, '\0'); + *buf++ = DELIM; + free(userpath); + } if (machinepath) { strcpy(buf, machinepath); buf = strchr(buf, '\0'); *buf++ = DELIM; free(machinepath); } - if (userpath) { - strcpy(buf, userpath); - buf = strchr(buf, '\0'); - *buf++ = DELIM; - free(userpath); + if (userpath || machinepath) { + buf[-1] = '\0'; + return; } #endif if (pythonhome == NULL) { diff --git a/PC/python_nt.rc b/PC/python_nt.rc index 71361fe..7e1ea5c 100644 --- a/PC/python_nt.rc +++ b/PC/python_nt.rc @@ -8,7 +8,7 @@ #include "modsupport.h" #include "patchlevel.h" -#define MS_DLL_ID "1.5.2" +#define MS_DLL_ID "1.5" #define PYTHON_VERSION MS_DLL_ID "." PYTHON_API_STRING "\0" @@ -28,8 +28,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 + FILEVERSION 1,5,2,1 + PRODUCTVERSION 1,5,2,1 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L |