summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-06-09 21:30:01 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-06-09 21:30:01 (GMT)
commit66f8c43b095a47b90f9887fac233aa7c8e3a3224 (patch)
tree3015d55aec7fc464516b908a88c2d5c52dca1f17 /PC
parent5b4a54c5d5a61375b663b25f2c99ea44219fc793 (diff)
downloadcpython-66f8c43b095a47b90f9887fac233aa7c8e3a3224.zip
cpython-66f8c43b095a47b90f9887fac233aa7c8e3a3224.tar.gz
cpython-66f8c43b095a47b90f9887fac233aa7c8e3a3224.tar.bz2
#5924: on Windows, a large PYTHONPATH (more than 255 chars) was completely ignored.
Will backport to 3.0.
Diffstat (limited to 'PC')
-rw-r--r--PC/getpathp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/PC/getpathp.c b/PC/getpathp.c
index 36abbf2..212f942 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -424,8 +424,6 @@ calculate_path(void)
wchar_t *buf;
size_t bufsz;
wchar_t *pythonhome = Py_GetPythonHome();
- char *_envpath = Py_GETENV("PYTHONPATH");
- wchar_t wenvpath[MAXPATHLEN+1];
wchar_t *envpath = NULL;
#ifdef MS_WINDOWS
@@ -434,13 +432,20 @@ calculate_path(void)
wchar_t *userpath = NULL;
wchar_t zip_path[MAXPATHLEN+1];
size_t len;
-#endif
+
+ if (!Py_IgnoreEnvironmentFlag) {
+ envpath = _wgetenv(L"PYTHONPATH");
+ }
+#else
+ char *_envpath = Py_GETENV("PYTHONPATH");
+ wchar_t wenvpath[MAXPATHLEN+1];
if (_envpath) {
size_t r = mbstowcs(wenvpath, _envpath, MAXPATHLEN+1);
envpath = wenvpath;
if (r == (size_t)-1 || r >= MAXPATHLEN)
envpath = NULL;
}
+#endif
get_progpath();
/* progpath guaranteed \0 terminated in MAXPATH+1 bytes. */